Why does trying to print directly to a file instead of sys.stdout produce the following syntax error:
sys.stdout
Python 2.7.2+ (default, Oct 4 2011, 20:06
print is a keyword in python 2.X. You should use the following:
f1=open('./testfile', 'w+') f1.write('This is a test') f1.close()