脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - python字典基本操作实例分析

python字典基本操作实例分析

2020-07-22 12:20企鹅不笨 Python

这篇文章主要介绍了python字典基本操作,实例分析了Python的打印输出、删除、赋值等常用技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了python字典基本操作。分享给大家供大家参考。具体如下:

?
1
2
3
4
5
6
d2 = {'spam': 2, 'ham': 1, 'eggs': 3} # make a dictionary
print d2 # order is scrambled
d2['ham'] = ['grill', 'bake', 'fry'] # change entry
del d2['eggs'] # delete entry
d2['brunch'] = 'Bacon' # add new entry
print d2

希望本文所述对大家的Python程序设计有所帮助。

延伸 · 阅读

精彩推荐