Mega Code Archive

 
Categories / Python Tutorial / File
 

Open a file and save text to it

f = open('temp.txt', 'w') for i in range(250):     f.write('%03d)  this is a test.\n' % i) f.close()