Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- from datetime import datetime
- match_str1 = "description"
- match_str2 = "interface"
- with open("config.txt") as f_in:
- lines = f_in.readlines()
- current_time = datetime.today().strftime("%d.%m.%Y_%H.%M.%S")
- with open("textfile1_{}.txt".format(current_time), "w") as f1_out, open("textfile2_{}.txt".format(current_time), "w") as f2_out:
- for line in lines:
- if match_str1 in line:
- f1_out.write(line)
- if match_str2 in line:
- f2_out.write(line)
- print( "\nDone!\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement