字符串转为字典import astline=input()linedict=ast.literal_eval(line)遍历字典for key in linedict: value=linedict[key]