python中popitem如何使用

421次阅读
没有评论

python中popitem如何使用

1、说明

用于返回并删除字典中的一个键值对,一般删除字典末尾的键值对。

2、语法

dict.popitem()

3、参数

dict:字典对象。

4、返回值

返回一个(key,value)形式的键值对。

5、实例

 a = {
     "name":"dlrb",
     "age":25,
     "height":168
 }
 a1 = a.popitem()
 print(a1)
神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2022-04-23发表,共计182字。
新手QQ群:570568346,欢迎进群讨论 Python51学习