我正在解析一个文件,并且我想构建一个包含用户选择的名称和值的字典。因为我有许多名字我想展现给用户的名称,他将选择的年龄:Python中的字典错误
Choose the age of Jack
choose the age of Kate
...
这里是我写的代码:
list_param = {}
for param in o["persons"]:
list_param.update({param["name"]: input("choose the age of", param["name"], " :\n")})
我得到这个错误:
TypeError: [raw_]input expected at most 1 arguments, got 3
我该如何修复它?
在此先感谢
为什么你期望input()接受多于一个参数?可以使用字符串标注或字符串插值。 –
@ user1833746顺便说一下,它是'concatenation':P – jackcogdill
@ user1833746:很可能是因为print()* * *。 –