📜  如何从python代码示例中的字符串中提取字典值

📅  最后修改于: 2022-03-11 14:45:14.559000             🧑  作者: Mango

代码示例1
import ast
temp = "'mycode':['1','2','firstname','Lastname']"
key,value = map(ast.literal_eval, temp.split(':'))
status = {key: value}