我希望用户输入字典列表,然后将跟进并执行一些搜索功能,但是用户input成为字符串
我希望用户输入类似的内容(请参阅下面要粘贴的数据)并将其作为字典列表直接分配给值性能,并将其分配给名为性能的变量。
我不想让用户单独逐项添加并将其更新到列表中,他们应该只粘贴下面的数据
我想使用纯Python或一些轻库,如sys(仅允许内置),请帮助
我下面写的在尝试提取值等时给我一个错误,因为它自动存储为字符串:
performance = (input('以字典列表形式输入您的数据库:'))
I want the user to input something like (refer below to data to paste) and assign it to the value performance directly as a list of dictionaries and this will be assigned to a variable called performance.
I do not want to make the user individually add item by item and update it into a list, they should just paste the data below
i want to use pure python or some light library like sys (built in only allowed), please help
What I have written below gives me an error when trying to extract values etc. since it is automatically stored as a string:
performance = (input('Enter your database as a list of dictionaries: '))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用函数 eval()评估了Python语法中提供的字符串:
PS在使用Eval()时要当心代码注入。
Use the function eval(), which parsed and evaluated the string provided in python syntax:
p.s. Beware of code injection while using eval().