【问题标题】:imdbpy Getting activity of actors/actresses from a listimdbpy 从列表中获取演员/女演员的活动
【发布时间】:2021-07-05 16:34:28
【问题描述】:

我想知道是否有人可以帮助我从一个节目中获得所有演员的女演员的电影作品列表?

full_cast = ia.get_movie('0203259', 'full credits')
full_cast = full_cast['cast']
full_cast

我可以通过以下方式获得一个人的电影:

ice_t=i.get_person('0001384')
for job in ice_t['filmography'].keys():
    print('# Job:', job)
    for movie in ice_t['filmography'][job]:
        print('\t t%s %s (role: %s)' % (movie.movieID, movie['title'], movie.currentRole))

但我不知道如何将上述函数应用于 full_cast。有人可以帮忙吗?

【问题讨论】:

  • 我不知道 full_cast 返回什么,但如果它返回包含个人 ID 号的内容,那显然只是 for person in full_cast: / per = i.get_person(person.id) 或其他什么。正确的?只是一个嵌套循环。
  • full_cast 返回一个包含 7K 人及其 ID 的列表,但恐怕我听不懂你在说什么。

标签: python imdbpy


【解决方案1】:

我认为您应该能够从文档中弄清楚这一点。

for person in full_cast:
    print(person['name'])
    for movie in person['filmography'].values():
        print('\t t%s %s (role: %s)' % (movie.movieID, movie['title'], movie.currentRole))

【讨论】:

  • 非常感谢您的帮助。我对 Python 很陌生,所以这对其他人来说并不那么直观。我从 imdb.Person import Person for person in full_cast: print(person['name']) for movie in person['filmography'].values(): print('\tt%s %s (role: %s )' % (movie.movi​​eID, movie['title'], movie.currentRole)) 我得到一个关键错误:filmography
猜你喜欢
  • 2015-06-20
  • 1970-01-01
  • 2019-04-23
  • 2013-11-22
  • 2013-05-19
  • 2012-12-26
  • 2022-11-28
  • 2019-04-16
  • 1970-01-01
相关资源
最近更新 更多