0
url = "https://technet.microsoft.com/en-us/library/hh135098(v=exchg.150).aspx"
r = requests.get(url)
soup = BeautifulSoup(r.content, 'lxml')
table = soup.find_all('table', attrs={"responsive": "true"})[0]
for rows in table.find_all('tr')[1]:
item = []
for val in rows.find('td'):
item.append(val.text.strip())
print (item)
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
TypeError: 'int' object is not interable
4号线是指for val in rows.find('td'):
什么呢'rows.find( 'TD')'的回报? – Mel
第4行还是第3行?对于val中的rows.find('td'):'是上面代码中的第7行。如果您包含* full * traceback,它实际上会向您显示违规行。 – SiHa