Check Python version from inside script? Run Pythons script in v2 compatibility mode?

Pavol Lisy pavol.lisy at gmail.com
Fri Jul 7 06:30:19 EDT 2017


On 7/7/17, Steve D'Aprano <steve+python at pearwood.info> wrote:

> import sys
> if sys.version_info >= (3,):  # the comma is important
>     print("version 3")

But be careful inside script! It could live long enough to see python4 :)



More information about the Python-list mailing list