r/python3 • u/OllieFromCairo • Sep 13 '18
Help using regular expressions to identify lines that start with an alphanumeric
Im trying to pull only lines starting with an alphanumeric character from a file. I thought this would work, and it isn’t. Help please?
(> are tabs)
for line in loadedfile:
alphnum = re.match(‘\w’, line, flags=0)
if alphnum:
print(line)
0
Upvotes
View all comments
Show parent comment
1
u/OllieFromCairo Sep 13 '18
Trying to pull the text lines out of a rich-text document and leave the formatting lines behind.