although this does not answer your question, to move data with print data is probably a bad idea: print is for short information printouts. it provides functions that are usually not needed when moving big data, such as formatting and adding EOL.
Instead, use something lower level, like write in the sys.stdout file sys.stdout (or some other file descriptor, this makes it easy to write to the file instead of stdout)
out=sys.stdout out.write(largedata)
you also probably want to re-delete the data before output:
# this is just pseudocode: for chunk in largedata: out.write(chunk)
.write does not add an EOL symbol, so outputting multiple pieces will be practically indistinguishable from outputting all in one big move. but you have the advantage of not overlapping any buffers.
source share