import sys
if sys.version_info.major >= 3: raw_input = input
eval(raw_input())
Or, better, just use the six package.
import sys
if sys.version_info.major >= 3: raw_input = input
eval(raw_input())