Skip to content

Instantly share code, notes, and snippets.

@achimnol
Created March 4, 2020 06:30
Show Gist options
  • Save achimnol/afe1608fd64692b57cf9aed2eaeb9262 to your computer and use it in GitHub Desktop.
Save achimnol/afe1608fd64692b57cf9aed2eaeb9262 to your computer and use it in GitHub Desktop.
A simple Python script to test long console output handling
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