有人可以帮助我理解如何将多个列表中的值作为函数参数传递吗?我正在尝试使用包含customerId的url更新每个myemailId的电子邮件。
到目前为止,我的代码:
emailId = [732853380,7331635674]
customerId = ['cust-12345-mer','cust-6789-mer']
for x, y in zip(emailId, customerId):
def update_email(emailId, token, user, notes="https://myurl.com/customer?customerId =" + customerId):
headers = { 'accept': 'application/json',
'Content-Type': 'application/json',
'token': token,
'user': user}
endpoint = 'email/'
body = {'emailId': emailId, 'user': user, 'notes': notes}
requests.put(url = host + endpoint, headers = headers, json=body)
return True
但是收到与以def update_email ...开头的行相对应的错误:
TypeError: must be str, not list
提