Created
December 11, 2012 02:42
-
-
Save MarcoPolo/4255475 to your computer and use it in GitHub Desktop.
matias stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment