Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #find an replace
- import re
- FILE_PATH = ""
- REGEX = r""
- REPLACE =""
- re_compiled = re.compile(REGEX)
- with open(FILE_PATH) as file:
- data = file.read()
- new_data = re.sub(REGEX,REPLACE, data)
- with open(FILE_PATH) as file:
- f.write(new_data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement