python3 and python2 file conversion

python3 and python2 file conversion

NOTE: Based on an example python2 python3 turn, turn python3 To python2, the code can 2to3 3to2 to

Steps:

  1. Installation 3to2 Library -> pip3 install 3to2
  2. Locate the file 3to2, the file is no suffix, python path in the Scripts folder. (anaconda is the same)
  3. Open cmd, use cd switched path to your 3to2case file path
  4. Enter python 3to2 -w [你要转换的文件地址]to complete the conversion

Description:

  1. Conversion is converted directly in the original code base, so it is necessary to retain the original document, a copy of the operation in advance
  2. You can batch convert files, the folder address can fill

Guess you like

Origin www.cnblogs.com/lucky75/p/11290814.html