Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- with open("file1.txt") as i: # open file for reading, i = input file
- with open("temp", "w") as o: # open temp file in write mode, o = output
- for l in i: # read line by line
- o.write("'%s', \n" % l[:-1]) # concate ' and text
- # ^ ^ added `'` for each line
- #os.remove("file2.txt") # delete old file. Note:this is not needed in postfix system
- os.rename("temp", "filetest2.txt") # rename file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement