4 ms·
It is both cute and horrifying to realize that Python has no builtin functionality for this.
by Iv 4y ago
It is both cute and horrifying to realize that Python has no builtin functionality for this.
- eloff 4y agosys.version_info I'm not sure why this guy is doing it the hard way.
- Iv 4y agoBecause, as mentioned several times in this discussion, if you give a python3 file to a python2 interpreter, you will get a SyntaxError even before the first line of the script runs. This is a way o ensuring the correct python version is used and to display a clear error message next to it.