Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. with open('test1') as file_in:
  2. text = file_in.read()
  3.  
  4. text = text.replace("TEST_OLD", "TEST_NEW")
  5.  
  6. with open("test2", "w") as file_out:
  7. file_out.write(text)
  8.  
  9. oldfile = open("file", "r")
  10. newfile = open("file_new", "w")
  11. for line in oldfile:
  12. s = line.replace("TEST_OLD","TEST_NEW")
  13. newfile.write(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement