概述
代码:def user(repo, language, page):
# import pdb;pdb.set_trace()
dictionary = {'language_search': language, 'page': page, 'followers': repo['followers'], 'github_repo': repo['name'],'forked?': repo['fork'], 'forks': repo['forks'], 'github_owner': repo['owner'], 'language': repo['language'], 'created_at': repo['created_at'], 'forks': repo['forks'], 'watchers': repo['watchers'], 'username': user['login'], 'type': user['type'], 'public_repos': user['public_repos'], 'followers': user['followers']}
fields_user = ['blog', 'company', 'location', 'name']
fields_repo = ['description']
if user.get('email'):
dictionary_2 = {'email': user['email']}
for key in fields_user:
if user.has_key(key):
dictionary[key] = user[key]
for key in fields_repo:
if repo.has_key(key):
dictionary[key] = repo[key]
shelf[dictionary_2['email']] = dictionary
shelf.sync()
return dictionary_2['email']
print dictionary_2['email']
出于某种原因,我一直收到这个错误: in user(repo, language, page)
1 def user(repo, language, page): #returns email address to pass into rapportive
2 # import pdb;pdb.set_trace()
----> 3 dictionary = {'language_search': language, 'page': page, 'followers': repo['followers'], 'github_repo': repo['name'],'forked?': repo['fork'], 'forks': repo['forks'], 'github_owner': repo['owner'], 'language': repo['language'], 'created_at': repo['created_at'], 'forks': repo['forks'], 'followers': user['followers']}
4 # dictionary = {, , 'watchers': repo['watchers'], 'username': user['login']} , 'type': user['type'], , 'public_repos': user['public_repos']
5 fields_user = ['blog', 'company', 'location', 'name']
TypeError: 'function' object is not subscriptable
我不明白为什么。我只想写更多的键:值对字典。但由于某种原因,这个错误一直没有得到解决。
最后
以上就是可靠蓝天为你收集整理的python对象不可订阅_“'function'对象不可订阅”的全部内容,希望文章能够帮你解决python对象不可订阅_“'function'对象不可订阅”所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复