I have a buggy long python project that I am trying to debug. Its messy and undocumented. I am familiar with python2.7. There are no binaries in this project. The straight forward idea is to try execute it as python2.7 file.py
or python3 file.py
and see which works. But as I said it is already buggy at a lot of places. So none of them is working. Is there any check or method or editor that could tell me if the code was written in python2.7 or python3?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
Use this in your code:
outputs a string: 2.7.10
Attempt to compile it. If the script uses syntax specific to a version then the compilation will fail.
add this line to the file:
this should automatically print the version along with the default help interface. remember to remove it later.