Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Keys & values of dictionaries

📅 2009-Oct-13 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ dictionary, python ⬩ 📚 Archive

adict = {3:"three", 5:"five", 0:"zero"}
klist = list(adict.keys())      # [0, 3, 5]
vlist = list(adict.values())    # ['zero', 'three', 'five']

© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧