Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. with open('file.txt', 'r') as file:
  2.     data_file = file.readlines()
  3.  
  4. with open('file.txt', 'w') as file:
  5.     for line in data_file:
  6.         if line == regexp: #сюда логику регэкспа
  7.             file.write(line)
  8.             file.write(special_line) # это доп строка при попадании в регэксп
  9.         else:
  10.             file.write(line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement