Question: python question i) What would the output of the program regtest.py be if it was given the input file phone.txt (below). regtest.py phone.txt import re

python question

i) What would the output of the program regtest.py be if it was given the input file phone.txt (below). regtest.py phone.txt import re phoneRegex = re.compile(r'''( (\d{2}|\(\d{2}\)) (\s|\.) (\d{8}) )''', re.VERBOSE) fileobj = open('phone.txt') data = fileobj.readlines() for number in data: number = number.strip() mo = phoneRegex.search(number) if mo: print(number + ' found ' + mo.group()) +61 8 92661000 +61 8 9266 1000 (08) 9266 1000 (08) 92661000 08 9266 1000 08 92661000 9266 1000 92661000 0892661000

python question i) What would the output of the program regtest.py be

j) Provide changes that would be required for regtest.py to completely and specifically match each of the number formats in the file

regtest hone.txt +61 8 92661000 +61 8 9266 1000 (08) 9266 1000 (08) 92661000 08 9266 1000 08 92661000 9266 1000 92661000 0892661000 import re phoneRegex re.compile(r''' ( )'"", re. VERBOSE) fileobjopen ( 'phone.txt') datafileobj.readlines() for number in data: mber.strip() number - nu mo - phoneRegex.search (number) if mo: print (number +'found' mo.group))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!