How to detect if code is python 3 compatible

后端 未结 5 1090
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 16:55

I\'m doing static code analysis using openstack/bandit. Do have a lot of repositories, some of those are in python 2 other in python 3. How can I detect if code is syntactically

5条回答
  •  灰色年华
    2021-02-01 17:25

    The most basic validation that you could do ensure your code is python3 compatible syntaxically is to run pylint3 for that particular module and look for errors.

    Install pylint3

    sudo apt-get install pylint3
    

    Run pylint3 for a python module

    pylint3 -E 
    

    The above could be used to catch syntax errors in a module with respect to python3.

提交回复
热议问题