我回顾了这个例子-Can someone explain me in detail how this code works regarding (Using Python to Access Web Data),并对代码中的最后一行提出了一个问题,其中count =0
有人能解释一下为什么要在那里吗?如果可能的话,@chitown88 88,您能帮上忙吗?
if count == position: #<------- and the variable to get the position
url = tag.get('href', None)
print("Retrieving:" , url)
count = 0 <----------------------------------------this line
break
谢谢,
发布于 2020-05-27 10:34:28
...
count = 0 # <-- Must reset this value.
...
while n < numbers:
...
for tag in tags:
...
if count == position:
...
count = 0 # <-- Resetting this value before the next for-loop.
break # <-- This breaks out of the for-loop, going back into the while-loop
https://stackoverflow.com/questions/62050303
复制