这本词典有一些带“.”的值。我想把这些值分开
d={'Id':200, 'Serv': 'df.WST', Floor: 'first', 'Wing': 'B.Wing'}
我希望它变成:(编辑)
d={'Id':200, 'Serv': 'df','WST', Floor: 'first', 'Wing': 'B','Wing'}
我试过分开(“.”)
d.values().split(".")
AttributeError: 'dict_values' object has no attribute 'split'
我找不到其他的方法
由于字典的值只能有一个列表/dict来表示多个对象,因此您可以在那里有一个列表,或者用一些字符将其连接起来:
试试这个
输出:
相关问题 更多 >
编程相关推荐