Dec-07-2017, 11:38 AM
me first attemp tis to be able to open this html file saved in my c:\temp\test.html
and search for all the text areas starting with http and finishing with .com
import re
import io
filename =input("type the file path:")
with io.open('filename','r','utf-8') as f:
for line in f:
line = line.strip()
if re.match("http","com",0,true,true) and len(line)==7:
print(line)
got this error
Traceback (most recent call last):
File "C:/temp/testestlast.py", line 4, in <module>
with io.open('filename','r','utf-8') as f:
TypeError: an integer is required (got type str)
and search for all the text areas starting with http and finishing with .com
import re
import io
filename =input("type the file path:")
with io.open('filename','r','utf-8') as f:
for line in f:
line = line.strip()
if re.match("http","com",0,true,true) and len(line)==7:
print(line)
got this error
Traceback (most recent call last):
File "C:/temp/testestlast.py", line 4, in <module>
with io.open('filename','r','utf-8') as f:
TypeError: an integer is required (got type str)