Advertisement
Guest User

replace

a guest
Oct 7th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. import sys
  2. import fileinput
  3.  
  4.  
  5. def find_and_replace(filename, old, new):
  6.     for line in fileinput.FileInput(filename, inplace=True):
  7.         line = line.replace(old, new)
  8.         sys.stdout.write(line)
  9.  
  10.  
  11. find_and_replace(sys.argv[1], sys.argv[2], sys.argv[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement