I was wondering if something like this possible:
import sys
if sys.version[0] == '2':
print 'this would fail in python3'
if sys.version[0] == '3':
print("and this would fail in 2")
Now, if this is executed either python2 or python3 would fail when running this code. Is there a way to run a piece of code only if it's the right version, completely ignoring it if it is the wrong version?