SHARE
TWEET

Untitled

a guest Jul 18th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #!/usr/bin/python
  3.  
  4. import os, sys
  5. import glob
  6.  
  7. stext = sys.argv[1]
  8. rtext = sys.argv[2]
  9. path = sys.argv[3]
  10. input = sys.stdin
  11. output = sys.stdout
  12. files = glob.glob(path)
  13. for file in files:
  14.  
  15.   input = open(file)
  16.   output = open(file + '_copy', 'w')
  17.   for s in input.xreadlines(  ):
  18.       output.write(s.replace(stext, rtext))
  19.   output.close(  )
  20.   input.close(  )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top