May-09-2017, 09:50 AM
(May-08-2017, 09:49 PM)nilamo Wrote: You could also redirect the output to a stringio object...
(May-09-2017, 09:39 AM)wavic Wrote: Or you can rewrite the print function
With all due respect, those are more of hacks...
Though for concatenating many small strings into a bigger one
io.StringIO
is a good option (especially if performance is an issue ..., especially for OP )
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.