+ 1
How to import nicly sys.stdout.write
Because print() adds a newline after each output, Google says that for python 2.x one has to import sys.stdout.write or __future__. To keep my code more compact I would like to import all of that like: from stdout.write from sys as write This seems not possible or I just miss the right syntax for it. Does someone knows the right syntax. Currently I use the method as object trick to mask the problem... lprint = stdout.write thx in advance
3 Réponses
+ 1
Did it better work with replacing 'write' by 'print', or you have still problems?
+ 1
Hi,
thx for your reply.
I thought it is possible to just import a single function/method (now I'm thinking of methods instead of functions it becomes more obvious that I can't import write directly).
yes using 2.7. the future approach is also working there, if you believe Google ;)
I just look for the shortest approach ;)