How to redirect 'print' output to a file? - Stack Overflow

文章推薦指數: 80 %
投票人數:10人

The most obvious way to do this would be to print to a file object: with open('out.txt', 'w') as f: print >> f, 'Filename:', filename # Python 2.x print('Filename:', ... Howarewedoing?PleasehelpusimproveStackOverflow.Takeourshortsurvey



請為這篇文章評分?