0
How to make all my print statements in python program to print() ?
I made my python program in PYTHON2.7 and for 3 version print() is used instead of print statement,how to replace them all provided the arguments of print statement are not altered. Approx 221 replacements are to be done,so please provide me with a suitable suggestion. If question sounds relevant,please give an upvote.
8 Respostas
+ 5
Check this out ;)
https://code.sololearn.com/ce918WeOlUa7/?ref=app
Although that's probably the easiest part of the porting, as Jan Markus indicated...
Plus it has to be enhanced with other cases like when you have spaces inside the print statement. Possibly the best to do it with regex...
+ 3
I was to slow with my Script. But I am also sure that is a Problem you should solve coding 😉
https://code.sololearn.com/cyvVuyXVzhqU/?ref=app
+ 1
one possibility would have been using "from future import print_function" or something like that at the top of your programs but that only works if you do it beforehand
0
You can find all print and replace with print() in an IDE
0
Jan Markus there are 775 lines in my program
0
Paul Grasser but what about arguments??
0
Look in the official documentation:
https://docs.python.org/3/howto/pyporting.html
0
but Kuba Siekierzyński correcting at 222 places is very hectic