Im new to this wonderful site. Kudos to the team here! I'm a python beginner!
Im trying to match a string in a file. im using re.match. it does work for other strings in the file except the one im interested into.
file has:
Dumping
..
..
Dumped
coordinates (.. ..)
..
..
EOF
i tried below script:
import re
f1 = open("problem_statment", "r")
f2 = open("outfile.txt", "w")
for line in f1:
if re.match("coordinates", line):
f2.write(line)
the outfile doesn't give me the result of 'coordinates' match.., where as if i replace 'coordinates' in above code to 'Dumping', it matches..
Im clueless why it isn't matching 'coordinates'. i want to print whole line.. please guide!
Thanks!