how to check if python 2 or 3 code example Example: get python version in code import platform print(platform.python_version())