eval转换

eval把字符串转换为原来的数据类型

字符串--》布尔值

# s = 'True'
# print(type(s), type(eval(s)))
字符串--》字典
s = '{"age": 18}'
print(type(s), type(eval(s)))

猜你喜欢

转载自www.cnblogs.com/albeexu/p/12951341.html
今日推荐