Created
February 8, 2012 07:13
-
-
Save Achimh3011/1766369 to your computer and use it in GitHub Desktop.
Python version elucidation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
try: | |
major, minor = sys.version_info.major, sys.version_info.minor | |
except AttributeError: | |
major, minor = sys.version_info[:2] | |
if major < 2 or major == 2 and minor < 7: | |
sys.stderr.write("You need at least Python 2.7 to run this program, but you only have %d.%d.\n"%(major,minor)) | |
sys.exit(1) | |
else: # only for testing this | |
sys.stderr.write("You have Python %d.%d.\n"%(major,minor)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment