4
python BeautifulSoup解析表
我正在学习pythonrequests和BeautifulSoup。为了进行练习,我选择编写一个快速的NYC停车票解析器。我能够得到一个非常丑陋的html响应。我需要抓住lineItemsTable并解析所有票证。 您可以通过以下步骤来复制页面:https://paydirect.link2gov.com/NYCParking-Plate/ItemSearch输入NY图版T630134C soup = BeautifulSoup(plateRequest.text) #print(soup.prettify()) #print soup.find_all('tr') table = soup.find("table", { "class" : "lineItemsTable" }) for row in table.findAll("tr"): cells = row.findAll("td") print cells 有人可以帮我吗?简单地寻找所有东西tr并不能帮助我。