Mega Code Archive

 
Categories / Python Tutorial / Introduction
 

Print to a file

logfile = open('mylog.txt', 'a') print >> logfile, 'Fatal error: invalid input!' logfile.close()