how to redirect 'print' output to a file using python?,f.close()