-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path2to3
More file actions
28 lines (15 loc) · 738 Bytes
/
2to3
File metadata and controls
28 lines (15 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 2to3
> Automated Python 2 to 3 code translation.
> More information: <https://docs.python.org/3/library/2to3.html>.
- Display changes that would be performed:
2to3 {{path/to/file.py}}
- Convert a Python 2 file to Python 3:
2to3 --write {{path/to/file.py}}
- Convert a specified Python 2 feature to Python 3:
2to3 --write {{file.py}} --fix={{raw_input}} --fix={{print}}
- Convert all features except *raw_input* the specified ones to Python 3:
2to3 --nofix={{raw_input}} --fix={{print}} example.py
- Display the list of available transformation features:
2to3 --list-fixes
- Convert an entire directory:
2to3 --output-dir={{path/to/code_python3_version}} --write-unchanged-files --nobackups {{path/to/code_python2_version}}