我有一本有两把钥匙的字典。
my_dict = {"Hello": {'count': 2, 'distance': 6}, "Clear": {'count': 8, 'distance': 8}}
我正在使用
a = ''.join(''.join((k, str(v))) for k,v in my_dict.items())
要将其转换为字符串进行打印,请执行以下操作:
"Hello" {'count': 2, 'distance': 6L} "Clear" {'count': 8, 'distance': 9L}
我想知道怎么才能把钥匙和计数打印出来:
"Hello" - count: 2
"Clear" - count: 8
https://stackoverflow.com/questions/51641812
复制相似问题