📜  在字典python代码示例中将字符串转换为整数

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

代码示例1
# if you have string and integer
for item in list_of_dicts:
    for key, value in item.iteritems():
        try:
            item[key] = int(value)
        except ValueError:
            item[key] = float(value) # use here str(value)