Created
March 4, 2020 06:30
-
-
Save achimnol/afe1608fd64692b57cf9aed2eaeb9262 to your computer and use it in GitHub Desktop.
A simple Python script to test long console output handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import sys | |
if __name__ == '__main__': | |
total_length = int(sys.argv[1]) | |
if len(sys.argv) == 3: | |
line_length = int(sys.argv[2]) | |
else: | |
line_length = 10_000 | |
i = 0 | |
chars = string.ascii_uppercase + string.ascii_lowercase + string.digits | |
while total_length > 0: | |
chunk_size = min(total_length, line_length) | |
print(chars[i % len(chars)] * chunk_size) | |
total_length = total_length - chunk_size | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment