Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  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( )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement