How can I save output printed in the python terminal to a text file, and how can I specify where it is to be saved to? For example, I know how to do this, but it really doesn't do anything as far as I've noticed:
sys.stdout = open('thefile.txt', 'w')
print "In a file?"
How can I actually get it to write this to a text file, and then be able to find that text file? (Or a file of any other form.)