Первая строка в table_rows - это строка заголовка. В строке заголовка нет тд, поэтому в строке нет нужных вам данных. Я добавил простой пропуск любой строки, содержащей менее 4-х элементов.
from urllib.request import urlopen
from bs4 import BeautifulSoup
url = "https://yugioh.fandom.com/wiki/Legend_of_Blue_Eyes_White_Dragon"
html = urlopen(url).read()
soup = BeautifulSoup(html)
title = soup.find("h2", {"class": "pi-item pi-item-spacing pi-title"})
print(title.text)
table = soup.find(id="Top_table")
table_rows = table.find_all("tr")
for tr in table_rows: # for each row
td = tr.find_all('td') # find all cells
if len(td) < 4:
continue
row = [i.text for i in td] # row = all cells from row combined (I thought this is a list that can be accessed by index??)
id = row[0] #this is the ROW giving me the problem, turns out can't be accessed by index :c
name = row[1]
rarity = row[2]
cardType = row[3]
print(row)
Возвращает следующее
['LOB-EN000', '"Tri-Horned Dragon"', 'Secret Rare', 'Normal Monster']
['LOB-EN001', '"Blue-Eyes White Dragon"', 'Ultra Rare', 'Normal Monster']
['LOB-EN002', '"Hitotsu-Me Giant"', 'Common', 'Normal Monster']
['LOB-EN003', '"Flame Swordsman"', 'Super Rare', 'Fusion Monster']
['LOB-EN004', '"Skull Servant"', 'Common', 'Normal Monster']
['LOB-EN005', '"Dark Magician"', 'Ultra Rare', 'Normal Monster']
['LOB-EN006', '"Gaia The Fierce Knight"', 'Ultra Rare', 'Normal Monster']
...