matias stuff

  • Download Gist
1 2 3 4 5 6 7 8 9 10 11
infile = open('infile.txt', 'r')
content = infile.readlines() #reads line by line and out puts a list of each line
infile.close() #close the input template file
#here is where you change
content[1] = "foo \n" #replaces content of the 2nd line (index 1)
outfile = open('outfile.txt', 'w') #open up an output file
outfile.writelines(content) #write the content to the file
outfile.close() #close the file (not realllly necessary but good practice)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.