Jul-28-2020, 01:13 PM
JennyYang
Hi there! What do you think in use the page content and re.search or re.findall function?
Almost like this:
Regards,
Martinelli
Hi there! What do you think in use the page content and re.search or re.findall function?
Almost like this:
import re import urllib.request var_page_content = urllib.request.urlopen("https://urlthatyouneed.com/").read() result = re.search(var_page_content, '1961') # it will return 1961 in string format print(result)Otherwise, use:
import re import urllib.request var_page_content = urllib.request.urlopen("https://urlthatyouneed.com/").read() result = re.findall(r'[0-9]+', var_page_content) # it will return all the numbers in string format print(result)Hope it can help you!
Regards,
Martinelli