How to use Windows systems :
(1) Copy the 2to3.py under tools/scripts under the Python installation package to the file directory that needs to be converted.
(2) DOS switch to the file directory that needs to be converted, Run command 2to3.py test.py
Printable test.py, differences in Python2 and Python3.
(3) DOS switch to the file directory that needs to be converted, Run command 2to3.py-w test.py
To back up test.py as a Test.py.bak file
test.py the corresponding format and the corresponding package to Python3
Congratulations, Python2 to Python3. Format modified successfully.
At the same time, it may be quite unusual to greet you. For example, the following description:
Symptom 1:
Typeerror:cannot use a string pattern on a Bytes-like object
Reason:
The regular expression is a Unicode string, but read () of Urlopen () is the ascii/bytes string.
The fix here was to compile a bytes object instead of a text string.
is changed to
Regix = Compile (b' # ([\d,]+) ')
-----not finished----
Continue to learn in
Python2 to Python3 conversion tool 2to3