text1.txt:
line1 hdfbghasbfas
line2 jdsbvbsf
line3 <match name="item1" rhs="domain.com"></match>
line4 <match name="item2" rhs="domainn.com"></match>
line5 <match name="item2" rhs="1010data.com"></match>
need to retrive domain.com,domainn.com,1010data.com to "result.txt"
``
import re
f1 = open("C:/Users/Netskope/Desktop/m/test1.txt", "r")
f2 = open("C:/Users/Netskope/Desktop/m/result.txt", "w")
d1 = f1.readlines()
for line in d1:
match = re.findall('<match name="item1" rhs="(\w.+")', line)
if match in line:
print match,
f2.write(match)
#f1.close()
}
TypeError: expected a character buffer object`Inline Code Example Here`