python遍历字典方法总结

介绍主要分为3大类:keys() 、values() 、items() 2 遍历 key 值方法一: data = {‘A’: 1, ‘B’: 3, ‘C’: 5} for key in data.keys(): print(f'{key}: {data[key]}’)1234 3 遍历 value 值data = {‘A’: 1, ‘B’: 3, ‘C’: 5} for values in dataRead More

Collapse