This piece of code, file test.py,
if 1: print \"foo\" print \"bar\"
can be successfully executed with execfile(\"test.py\
execfile(\"test.py\
One other solution I recently found for a similar problem:
$ python << EOF if 1: print "foo" print "bar" EOF