0

私はどこでも調査しましたが、問題が発生しています.....個々の要素にアクセスし、空のpythonリストに値を追加したいです...そしてもちろん、pythonリストに正しいデータを取得した後、私は行きますそれらをcsvファイルに追加するには...

from urllib.request import urlopen
from bs4 import BeautifulSoup
import csv

html = urlopen("http://exoweb0.donbest.com/checkHTML/servlet/send_archive_history.servlet?by_casino=1&for_casino=37&league=1&game=0&date=20151029")
soup = BeautifulSoup((html), "html.parser")
trs = soup.findAll("tr")
dates = []
rotations = []
games = []
lines = []
types = []
for tr in trs.children:
  print(tr)
  #tds =  tr.findAll("td") 'Finds all tds in current tr
  #print (tds)
  #date = tds.contents[0] ' It reference the first element in each td
  #rot = tds[2]   ' It reference the third element in each td
  #game = tds[3] ' It reference the fourth element in each td
  #line = tds[4] ' It reference the fith element in each td
  #type_l = tds[5] ' It reference the sixth element in each td

  #dates.append(date)  Trying to append to my empty list
  #rotations.append(rot)
  #games.append(game)
  #lines.append(line)
  #types.append(type_l)
4

0 に答える 0