page_soups = []for page in range(1, 51): url = 'https://etherscan.io/txs?p=' + str(page) print(url) req = Request(url, headers={'User-Agent': 'Mozilla/5.0'}) webpage = urlopen(req).read() page_soup = soup(webpage, "html.parser").find('tbody').find_all('a') page_soups += page_soup我使用循环来抓取多个网页,但只能获取前 30 页的数据。第31条有错误如下错误我检查该网页,发现它仍然具有与其他网页相同的标签和元素。请帮我。
1 回答
月关宝盒
TA贡献1772条经验 获得超5个赞
确保以Python 期望的确切格式输入数字。
num1 = complex(input("Enter a number: "))
num2 = complex(input("Enter another number: "))
print(f"{num1} + {num2} = {num1 + num2}")
print(f"{num1} - {num2} = {num1 - num2}")
print(f"{num1} * {num2} = {num1 * num2}")
print(f"{num1} / {num2} = {num1 / num2}")
工作得很好(尽管有浮点精度):
$ python3 socom.py
Enter a number: 2.44-77.3333j
Enter another number: 6.83+15j
(2.44-77.3333j) + (6.83+15j) = (9.27-62.333299999999994j)
(2.44-77.3333j) - (6.83+15j) = (-4.390000000000001-92.3333j)
(2.44-77.3333j) * (6.83+15j) = (1176.6646999999998-491.5864389999999j)
(2.44-77.3333j) / (6.83+15j) = (-4.208867770125335-2.0791044579970688j)
添加回答
举报
0/150
提交
取消