(Oct-27-2017, 04:44 PM)heiner55 Wrote: Your program is not the same as mine.
Paste my sample and run it.
#!/usr/bin/python3 import re pattern = r""" tel: # tel: \s*? # maybe some spaces \+44 # +44 \s*? # maybe some spaces (\d{10,10}) # 10 digits """ with open ('phone_log.txt') as in_file: for linenr, line in enumerate(in_file): match = re.search(pattern, line, re.X) if match: print("Line %d: %s" % (linenr, match.group(1))) #done
So I should copy:
#!/usr/bin/python3
import re
pattern = r"""
tel: # tel:
\s*? # maybe some spaces
\+44 # +44
\s*? # maybe some spaces
(\d{10,10}) # 10 digits
"""
with open ('phone_log.txt') as in_file:
for linenr, line in enumerate(in_file):
match = re.search(pattern, line, re.X)
if match:
print("Line %d: %s" % (linenr, match.group(1)))
#done
into my shell and then run it?
and what run option do i select, since there is
- run python
- run shell
and is the re.compile needed at all? since that is missing