(Jul-19-2018, 01:48 PM)snippsat Wrote: As mention bye @buran use 2to3.py that comes with python. # greet.py # Python 2.7 def greet(name): return("Hello, {}!".format(name)) name = raw_input("What's your name? ") print 'Hello {}'.format(greet(name)
From command line: C:\Python37\Tools\scripts λ python 2to3.py -w greet.py
After Python 3 code: # greet.py # Python 3.7 def greet(name): return("Hello, {}!".format(name)) name = input("What's your name? ") print('Hello {}'.format(greet(name)))
Will the 2to3 library solve the entire issue automatically, or will i have to make some changes manually too apart from what changes the 2 to 3library makes.
Will the 2 to 3 tool also convert the ‘libraries of 2’ to the libraries of 3 automatically
(Jul-19-2018, 01:19 PM)buran Wrote: saisankalpj dateline="<a href="tel:1532004801">1532004801</a>' Wrote: 1.will I be able to run the same code it python 3.6 with minimal changes?
it's difficult to say without seeing actual code saisankalpj dateline="<a href="tel:1532004801">1532004801</a>' Wrote: 2.Do libraries also vary in 3.6 from those used in python 2.7.14??
again - there are differences, but if your code is affected depends. it's difficult to say without seeing actual code. saisankalpj dateline="<a href="tel:1532004801">1532004801</a>' Wrote: 3.will the import statements like "from ABC import xyz" also vary from both these versions
depends if your code uses libraries that has changed. For example its Tkinter in python 2, but tkinter in python3. There is 2to3 tool that can help with the convertion
Will the 2to3 library solve the entire issue automatically, or will i have to make some changes manually too apart from what changes the 2 to 3library makes.
Will the 2 to 3 tool also convert the ‘libraries of 2’ to the libraries of 3 automatically