当前位置:网站首页>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
边栏推荐
- 上位机开发(固件下载软件之需求分析)
- Solution: unsatisfieddependencyexception: error creating bean with name 'authaspect':
- Kotlin插件 kotlin-android-extensions
- [image detection] SAR image change detection based on depth difference and pcanet with matlab code
- Leetcode: Sword finger offer 66 Build product array [application of pre and post infix]
- 新知识:Monkey 改进版之 App Crawler
- leetcode:剑指 Offer 63. 股票的最大利润【记录前缀最小和 or 无脑线段树】
- Dépannage de l'opération cl210openstack - chapitre expérience
- May training (day 28) - Dynamic Planning
- descheduler 二次调度让 Kubernetes 负载更均衡
猜你喜欢

Troubleshooting of cl210openstack operation -- Chapter experiment

Install MySQL tutorial

【图像去噪】基于高斯滤波、均值滤波、中值滤波、双边滤波四种滤波实现椒盐噪声图像去噪附matlab代码

Bid farewell to the charged xshell, and the free function of tabby is more powerful

2 variables and basic types

(14)Blender源码分析之闪屏窗口显示软件版本号

libprint2

(14) The software version number is displayed in the flash window of blender source code analysis

【图像去噪】基于非局部欧几里德中值 (NLEM) 实现图像去噪附matlab代码
![[image denoising] image denoising based on partial differential equation (PDE) with matlab code](/img/65/f8617beb05e163bd5f7dbade99a4a1.png)
[image denoising] image denoising based on partial differential equation (PDE) with matlab code
随机推荐
New knowledge: monkey improved app crawler
Process when solving vagrant up_ builder. rb:43:in `join‘: incompatible character encodings: GBK and UTF-8
【数据聚类】本专栏中涉及数据集、可视化及注意事项
d不能用非常ctfe指针
【图像去噪】基于高斯滤波、均值滤波、中值滤波、双边滤波四种滤波实现椒盐噪声图像去噪附matlab代码
esp32 hosted
Set judge the existence of intersection
Flink practice
android studio 利用数据库实现登录注册界面功能
上位机开发(固件下载软件之需求分析)
Category 7
Jackson XML is directly converted to JSON without writing entity classes manually
"I was laid off by a big factory"
Drawing grid navigation by opencv map reading
June 9th training day - bit operation
Zhang Chi: is process a panacea?
The second revolution of reporting tools
5、 El expression & JSTL tag library
May training (day 28) - Dynamic Planning
推荐17个提升开发效率的“轮子”