Writing to Files : write « File « Python Tutorial






logfile = open('test.log', 'w')           
logfile.write('test succeeded')                
logfile.close() 
print file('test.log').read()                 
logfile = open('test.log', 'a')                 
logfile.write('line 2') 
logfile.close() 
print file('test.log').read()








12.16.write
12.16.1.write(string)
12.16.2.Writing to Files
12.16.3.Opening and writing to a file.