Hello im a beginner in python. ive got a txt file. this file contains
hello
hello 11.11.22
my code should be able to read the file and if there exist a string "hello" with a number after.( the number may contain variations.) the program should write after the number in the same line "TEST".
my code
import re
with open('sonicwall.txt', 'r') as searchfile:
for line in searchfile:
if re.search('hello' and [00-100000], line, re.M|re.I):
searchfile.append("TEST")
result should be in file:
hello
hello 11.11.22 TEST