当我遇到以下奇怪行为时,我正在使用 IMDbPY 库来抓取大量电影的详细信息
import imdb
s_result = ia.search_movie('"Jobs"')
movie = s_result[0]
ia.update(movie)
for x in xrange(3):
print movie['cast'][x]
输出是:
>>Ashton Kutcher
Dermot Mulroney
Josh Gad
这很好,但是当我尝试使用迭代器时:
print [movie['cast'][x] for x in xrange(3)]
输出是:
>>>[<Person id:0005110[http] name:_Kutcher, Ashton_>, <Person id:0000551[http] name:_Mulroney, Dermot_>, <Person id:1265802[http] name:_Gad, Josh_>]
请告诉我我做错了什么?