#grabs regex pattern from text in user inputs import re text = input("Enter text here:") getids = re.compile('id="(.{1,10})"') ids = getids.findall(text) for id in ids: print(id)
#grabs regex pattern from text in website.txt file import re text = open("website.txt", 'r') #finds website.txt file within python program folder getids = re.compile('<a href="(.+?)"')#Show what it looks for ids = getids.findall(text.read())#Look with instructions up above to look for all links within website for id in ids:#prints all links within website print(id)