小编bsk*_*ets的帖子

如何通过 API 在 Github 中授权 ssh 密钥

我的 Github 组织要求对所有成员进行 SAML SSO 身份验证,这需要将新的 ssh 密钥添加到要授权的帐户(https://help.github.com/en/github/authenticating-to-github/authorizing-an-ssh-用于 saml 单点登录的密钥)。我尝试研究和查看他们的 API 文档,但我找不到任何有关通过 API 授权 ssh 密钥的信息。

谁能帮我吗?

python api github python-requests pygithub

7
推荐指数
1
解决办法
520
查看次数

如何将列表元素添加到字典中

假设我有dict = {'a':1,'b':2'}我还有一个列表= ['a','b,'c','d','e'].目标是将列表元素添加到字典中,并打印出新的dict值以及这些值的总和.应该是这样的:

2 a
3 b
1 c
1 d
1 e
Total number of items: 8
Run Code Online (Sandbox Code Playgroud)

相反,我得到:

1 a
2 b
1 c
1 d
1 e
Total number of items: 6
Run Code Online (Sandbox Code Playgroud)

到目前为止我所拥有的:

def addToInventory(inventory, addedItems)
    for items in list():
        dict.setdefault(item, [])

def displayInventory(inventory):
    print('Inventory:')
    item_count = 0
    for k, v in inventory.items():
       print(str(v) + ' ' + k)
       item_count += int(v)
    print('Total number of items: ' + str(item_count))

newInventory=addToInventory(dict, list)
displayInventory(dict)
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!

python dictionary list python-3.x

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×2

api ×1

dictionary ×1

github ×1

list ×1

pygithub ×1

python-3.x ×1

python-requests ×1