简体   繁体   English

如何从 python 的字典中的另一个键值对中弹出一个键值对

[英]How to pop out a key-value pair from within a another key value pair in dictionaries in python

My question is that how can I pop out say for example 'Phone#: ' or 'Email: ' or 'Area: ' because I know we can pop out the whole 'maulik' key and get rid of the entire key-value pair.我的问题是,我怎样才能弹出例如“电话#:”或“电子邮件:”或“区域:”,因为我知道我们可以弹出整个“maulik”键并摆脱整个键值对.

contacts = {
    'maulik':{'Phone#: ':1234567,'Email: ':'askm00@gmail.com','Area: ':'NorthBrunswick'},
    'jaysen':[2345678, 'ja69@it.edu','Iselin']
}

You're looking for contacts['maulik']['Phone#: '] or del contacts['maulik']['Phone#: ']您正在寻找contacts['maulik']['Phone#: ']del contacts['maulik']['Phone#: ']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何根据 Python 中的公共键值对有效地将键值从一个字典列表插入另一个字典列表? - How to efficiently insert key-value from one list of dictionaries to another based on a common key-value pair in Python? 基于从python字典中分组删除键值对 - Remove key-value pair based on grouping from dictionaries in python 如何根据具有两个键值对的词典列表中的另一个kv对的值创建一个键值对中的值列表 - how to create a list of values from one key-value pair based on the value of another k-v pair from a list of dictionaries with two key-value pairs 如何从 python 中的键值对中搜索键 - How to search key from key-value pair in python 在键值对中找到最大值-Python字典 - Finding the highest value in a key-value pair - python dictionaries Python-具有相似键值对的匹配字典 - Python - Matching dictionaries with similar key-value pair 如果字典中的键值具有共同的键值对,如何合并它们? - How to merge key values within dictionaries if they have a common key-value pair? 使用另一个列表中的键值对更新python词典列表 - Updating a list of python dictionaries with a key, value pair from another list 如果字典具有公共键值对,如何在两个列表中合并字典? - How to merge dictionaries within two lists if they have a common key-value pair? 如何使用python从一个大的json文件中找出特定的键值对 - How to find out specific key-value pair from a big json file using python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM