【发布时间】:2015-01-09 23:41:05
【问题描述】:
我在 Python 上使用 Rotten Tomatoes SDK,我正在尝试获取我正在搜索的所有电影的列表,但是当我提出请求时,我只能显示一个结果(因为:电影[0]['title']),我怎样才能得到所有的电影?
这是我的代码:
from rottentomatoes import RT
RT_KEY = 'XXXXXXXXX'
rt = RT(RT_KEY)
movie = raw_input('Enter the movie name: ')
fl = rt.search(movie, page_limit= 5)
title = fl['title'] #In order to work properly and show one result I should use fl[0]['title']
print title
但是当我运行程序时,在 'title=' 行上显示“TypeError: string indices must be integers, not str”错误。如何显示所有结果? (在字符串中)请帮忙
【问题讨论】:
标签: python string sdk int typeerror