python - Extracting from File using Regular Expression -
i have text document extract phrases from. phrase "mmarc5_" followed 4 numbers. have far:
with open("file.txt") f: re = (mmarc5_) re.findall(mmarc5_\d{4}", f.read()) i keep getting error:
nameerror: name 'mmarc5' not defined.
you forgot quotes:
re.findall(r"mmarc5_\d{4}", f.read()) and line doesn't make sense, delete it:
re = (mmarc5_) did import re module?
import re
Comments
Post a Comment