1

我有一个演员对象,它有名字和id,我可以取名字,但不能取id

请看

>>> actor
<Person id:0000199[http] name:_Pacino, Al_>
>>> actor["name"]
u'Al Pacino'
>>> actor["id"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IMDbPY-5.0-py2.7-macosx-10.6-intel.egg/imdb/utils.py", line 1469, in __getitem__
    rawData = self.data[key]
KeyError: 'id'
>>> 
4

1 回答 1

5

使用对象的.personID属性Person

actor.personID
于 2016-08-24T21:53:56.230 回答