我有一份清单
"SecretList"
:["GitHubToken","GitHubUser"]
def handler(event, context):
response_data = {}
try:
param = " "
param_value = [event['SecretList']]
for i in range(len(param_value)):
param[i] = “ “.join(map(str, param_value[1])
value = get_parameters(param[i])
print (value)
except Exception as e:
print (e)
需要单独字符串中的列表项
str1=GitHubToken
str2=GitHubUser
我的逻辑不起作用,有人可以建议我吗
答案 0 :(得分:0)
def handler(event, context):
response_data = {}
try:
param = {}
param_value = event['SecretList']
for index, value in enumerate(param_value):
param.update({'str{}'.format(index): value})
print param #output: {'str1': 'GitHubUser', 'str0': 'GitHubToken'}
except Exception as e:
print (e)
答案 1 :(得分:0)
我使用了以下逻辑:
def handler(event, context):
response_data = {}
try:
param = {}
param_value = event['SecretList']
for idx, item in enumerate(param_value):
print (idx)
value = get_parameters(param_value[idx])
print (value)
except Exception as e:
print (e)