Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('file.txt', 'r') as file:
- data_file = file.readlines()
- with open('file.txt', 'w') as file:
- for line in data_file:
- if line == regexp: #сюда логику регэкспа
- file.write(line)
- file.write(special_line) # это доп строка при попадании в регэксп
- else:
- file.write(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement