我不太确定这个while循环是在创建无限循环。
def read_m_by_rating(first_year,last_year,top_number):
current_index=1
final_list=[]
while current_index <=top_number:
url="http://www.imdb.com/search/title?at=0&sort=user_rating&start="+str(current_index)+"&title_type=feature&year=2005,2014"
print url
if top_number==55:
lis=read_m_from_url(url,top_number-current_index+1)
else:
lis=read_m_from_url(url,50)
final_list=lis
current_index +=50
return final_list
read_m_by_rating(2005,2015,55)
答案 0 :(得分:2)
这是你的循环:
while current_index <=top_number:
url="http://www.imdb.com/search/title?at=0&sort=user_rating&start="+str(current_index)+"&title_type=feature&year=2005,2014"
print url
if top_number==55:
lis=read_m_from_url(url,top_number-current_index+1)
else:
lis=read_m_from_url(url,50)
这是修改current_index
:
这是修改top_number
:
请注意,没有行可以修改其中任何一个变量。也许应该有?