Personal I need a help for code in Python
looking for internet result.
Python 3.6
The first one of Bitcoin
worked, the second one with error.
from urllib import request
url = request.urlopen("https://dolarhoje.com/bitcoin-hoje/").read()
url = str(url)
find = '<input type="text" id="nacional" value="'
posicao = int(url.index(find) + len(find))
BitCoin = url[ posicao : posicao + 8 ]
print("Valor BitCoin Hoje: "+ BitCoin + " R$")
url2 = request.urlopen("https://www.ativo.com/calendario/inscricoes/america-do-sul/br/mg/belo-horizonte/corrida-de-rua/36044/park-run-2019").read()
url2 = str(url2)
find = '<div class="row_header titulo_evento"'
posicao1 = int(url2.index(find) + len(find))
Running = url2[posicao1 : posicao1 + 4]
print("Corrida BH: 2019" + Running)
Result:
/usr/bin/python3.6 /home/system/Documents/Labs/Python/CrawlerPy/Crawler.py Valor BitCoin Hoje: 15186,97 R$ Traceback (most recent call last): File "/home/system/Documents/Labs/Python/CrawlerPy/Crawler.py", line 14, in <module> posicao1 = url2.index(find) + len(find) ValueError: substring not found Process finished with exit code 1