import re
driver = webdriver.Chrome()
driver.maximize_window()
driver.get('file:///C:/Users/abc/Desktop/MercadoLivre.html')
html = driver.page_source
lista = re.split('<|\\>|\\n',html)
#lista = html.split("<")
inputs = []
for elem in lista:
if elem.find("input name") != -1:
inputs.append(elem)
#print(inputs)
str = ""
for elem in inputs:
str = str + elem
fat = str.split(" ")
#print(fat)
inputs2 = []
for elem in fat:
if elem.find("name") != -1:
inputs2.append(elem)
str = ""
for elem in inputs2:
str = str + elem
fat2 = str.split('\"')
#print(fat2)
inputs3 = []
for elem in fat2:
if elem.find("name") == -1 and elem.find("price") != -1:
inputs3.append(elem)
print(inputs3)
Sem comentários:
Enviar um comentário