当前位置:网站首页>Pyhon的第五天
Pyhon的第五天
2022-06-12 07:01:00 【cxy003344】
1.dict和list中copy方法画图加代码解释
dict
浅拷贝


深拷贝


list
浅拷贝


深拷贝


2.dict中扩展字典长度(多种方法)
setdefault(self, key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
如果键不在字典中,则插入值为默认值的键。
Return the value for key if key is in the dictionary, else default.
如果 key 在字典中,则返回 key 的值,否则返回默认值。

update(self,E=None,**F):
D.update([E,]**F)->None.Update D from dict/iterable E and F.
从字典/可迭代 E 和 F 更新 D。
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
如果 E 存在并且具有 .keys() 方法,则对于 E 中的 k:D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
如果 E 存在并且缺少 .keys() 方法,则对于 E 中的 k, v:D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
在任何一种情况下,这后面跟着:对于F中的k:D[k] = F[k]
[key] 
3.dict中获取所有的key,获取所有的value,获取所有的item
key

value

item
4.dict中通过一个不存在的key去获取值(要求不报错)
setdefault

get

5.定义空集合

6.set中,求差集,求合集,求交集(要求在原集合上操作)
差集

合集

交集

添加一个元素

删除一个元素(使用多种方法)
pop
clear
discard


difference_update
边栏推荐
- Junior high school education, less than 3k, to 30k+ monthly salary, how wonderful life is without restrictions
- Tomato learning notes dvector and other basics
- Matlab 6-DOF manipulator forward and inverse motion
- Descscheduler secondary scheduling makes kubernetes load more balanced
- Summary from November 29 to December 5
- Troubleshooting of cl210openstack operation -- Chapter experiment
- 上传文件(post表单提交form-data)
- libprint2
- 2 variables and basic types
- June 9th training day - bit operation
猜你喜欢

数据库全量SQL分析与审计系统性能优化之旅

报表工具的二次革命
![Leetcode: Sword finger offer 67 Convert string to integer [simulation + segmentation + discussion]](/img/32/16751c0a783cc3121eddfe265e2f4f.png)
Leetcode: Sword finger offer 67 Convert string to integer [simulation + segmentation + discussion]

postman拼接替换参数循环调用接口

Kotlin插件 kotlin-android-extensions

Database syntax related problems, solve a correct syntax
![leetcode:890. Find and replace mode [two dict records set]](/img/a8/e1ea743bbd8d2aca4de3e3ac3b4ac3.png)
leetcode:890. Find and replace mode [two dict records set]

Kali与编程:如何快速搭建OWASP网站安全实验靶场?

leetcode:剑指 Offer 63. 股票的最大利润【记录前缀最小和 or 无脑线段树】

SQL language
随机推荐
An error occurred while downloading the remote file The errormessage
Throw away the ugly toast. The movable toast is more interesting
最近面了15个人,发现这个测试基础题都答不上来...
Jackson XML is directly converted to JSON without writing entity classes manually
sql server2019安装到这步无法进行下一步了,如何解决?
上位机开发(固件下载软件之需求分析)
Set judge the existence of intersection
循环链表和双向链表—课上课后练
libprint2
五月集训(第28天)——动态规划
(14) The software version number is displayed in the flash window of blender source code analysis
2 variables and basic types
4 expression
Go common usage
Category 7
8. form label
android studio 利用数据库实现登录注册界面功能
Are you still using like+% for MySQL fuzzy query?
d不能用非常ctfe指针
集合判断存在交集