While working on an image file I have, I tried reading it into a string and printing it on my IDLE 3.6
. The string is roughly 160K bytes long and I already saved it into a txt file on my machine. That took about a second, so I figured printing it would take about the same...
Never have I been so wrong...
Now, I checked this and the first answer suggests that the print itself is problematic. In their case, the format was non-standard, so I'm not sure if my case is the same. Second, if the print is the problem, why the IDLE seem to be slow after the print is done?
This is how I run it:
with open(location_of_160KB_png_file, "rb") as imageFile:
f = imageFile.read()
b = bytearray(f)
b=''.join([str(bb) for bb in b])
b[:10] # this prints easily (on IDLE I don't have to use _print_ function, I can just type the variable name)
b # this, however...