Writing to Files : Write : File PYTHON TUTORIALS


PYTHON TUTORIALS » File » Write »

 

Writing to Files


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()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo File
» Write