Я проверяю детали теста по крикету. Я проверил результаты, теперь я хочу сохранить его в файле.при сохранении HTML в файле я получаю str object cannot be interedpreted as an integer
это мой код
for i in range(0, 2000):
url = 'http://search.espncricinfo.com/ci/content/match/search.html?search=test;all=1;page=%s' %i
html = requests.get(url)
print ('Checking page %s of 2000' %(i+1))
soupy = bs4.BeautifulSoup(html.text, 'html.parser')
time.sleep(1)
for new_host in soupy.findAll('a', {'class' : 'srchPlyrNmTxt'}):
try:
new_host = new_host['href']
except:
continue
odiurl = BASE_URL + new_host
new_host = odiurl
print(new_host)
html = requests.get(new_host).text
with open('espncricinfo-fc/{0!s}'.format(str.split(new_host, "/")[4]), "wb") as f:
f.write(html)
я получаю эту ошибку str object cannot be interedpreted as an integer
Я получаю сообщение об ошибке в этой строке
с открытым ('espncricinfo-fc / {0! S}'. Format (str.split (new_host, "/") [4]), "wb ") как f: