Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ****
- ****
- ****
- ****
- import re
- with open ('file1.txt') as fil1:
- for line in fil1:
- re.sub('^*{3}[*]*','**',line)
- import fileinput
- with fileinput.FileInput('file1.txt', inplace=True) as fil1:
- for line in fil1:
- text = re.sub('^*{3}[*]*','**', line.rstrip()).strip()
- if text:
- print(text) # inside the `with` clause, print writes to the file automatically
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement