我是 python 的新手。如果有人知道我的代码发生了什么,我需要帮助吗?app_reviews = []for ap in tqdm(app_packages):for score in list(range(1,6)):for sort_order in [Sort.MOST_RELEVANT, Sort.NEWEST]:rvs, _ = reviews(ap,lang='en',country='us',sort=sort_order,count= 200 if score == 3 else 100,filter_score_with=score)for r in rvs:r['sortOrder'] = 'most_relevant' if sort_order == Sort.MOST_RELEVANT else 'newest'r['appId'] = apapp_reviews.extend(rvs)错误出现File "<ipython-input-33-c40fb4fad079>", line 3 for score in list(range(1,6)): ^ IndentationError: expected an indented block
1 回答
萧十郎
TA贡献1815条经验 获得超13个赞
您需要注意缩进,这在 Python 中非常重要。与其他语言不同,当你得到一个条件块时,你需要在它像括号一样进行制表。
app_reviews = []
for ap in tqdm(app_packages):
for score in list(range(1,6)):
for sort_order in [Sort.MOST_RELEVANT, Sort.NEWEST]:
rvs, _ = reviews(
ap,
,
country='us',
sort=sort_order,
count= 200 if score == 3 else 100,
filter_score_with=score
)
for r in rvs:
r['sortOrder'] = 'most_relevant' if sort_order == Sort.MOST_RELEVANT else 'newest'
r['appId'] = ap
app_reviews.extend(rvs)
添加回答
举报
0/150
提交
取消