The resource loading... loading...

Modifications of Python 2.x.x with Python 3.x.x & Methods of converting Python 2.x.x to Python 3.x.x

Author: Inventors quantify - small dreams, Created: 2016-10-09 12:36:49, Updated: 2017-10-11 10:18:05

The code is there.

In addition, a bak file was added: 34563264_data_from_site.py.bak, and the difference can be seen by comparing the two:

img

当前,对于2to3.py本身,也可以通过help查看到更多的用法:

D:\tmp\tmp_dev_root\python\python2_to_python3>D:\tmp\WordPress\DevRoot\Python27\Tools\Scripts\2to3.py -h
Usage: 2to3 [options] file|dir ...
 
Options:
  -h, --help            show this help message and exit
  -d, --doctests_only   Fix up doctests only
  -f FIX, --fix=FIX     Each FIX specifies a transformation; default: all
  -j PROCESSES, --processes=PROCESSES
                        Run 2to3 concurrently
  -x NOFIX, --nofix=NOFIX
                        Prevent a transformation from being run
  -l, --list-fixes      List available transformations
  -p, --print-function  Modify the grammar so that print() is a function
  -v, --verbose         More verbose logging
  --no-diffs            Don't show diffs of the refactoring
  -w, --write           Write back modified files
  -n, --nobackups       Don't write backups for modified files

This is just a brief explanation:

(1) If the above-added -w parameter is not used, the default is simply to print the diff content corresponding to the conversion process and export it to the current window.

(2) Add -w, which means that the changed content is written back to the original document.

(3) If you don't want to generate bak files, you can add -n.

(4) Don't want to see that bunch of output, plus no-diffs, that's it.

The rest of the story is not much more detailed.

The use of 2to3 above is translated fromOn the road

I've re-edited it, and if there are any mistakes, please point them out! ^_^


More

FangBeiIs there a Python 2 for botvs?

Inventors quantify - small dreamsThe BotVS retrieval server uses Python version 2.7, which supports both Python 2 and Python 3 for the BotVS platform.