当前位置:网站首页>Basic operations of dict and set
Basic operations of dict and set
2022-06-12 23:41:00 【Struggling youth Pavilion】
dict Three methods of expanding dictionary in
1 The first is direct use key=value

2 Second use setdefault

3 Use update

Two dict Get all the key, Get all value, Get all items
keys

values

items

Three definition empty set

6set in , Difference set , Collection , Find the intersection
Difference set

Collection

intersection

Four Add an element
use set.add

Delete an element

5、 ... and dict and list in copy Method drawing and code explanation
list——date1=list——date2 It's equivalent to a direct assignment Changing one of them will affect the other
and list——date3 and list——date4 It is a slice copy that changes one without affecting the other

dict Shallow copy ,dict_data1 and dict_data2 The two are independent , But the elements inside point to the same , So after a change , The other will change with it


dict Deep copy, full copy , They are completely independent , Even if you change one , The other remains the same


边栏推荐
- 2202 resume making
- 同花顺开证券账户怎么样?到底安不安全呢
- How to package a colorpicker component for color selection?
- 36 krypton's debut | "osogena" won nearly ten million angel rounds of financing. The original DLR scientists of German Aerospace Research and development system modeling and simulation CAE software PA
- [recommended collection] easy to understand graphic network knowledge - Part 1
- So, what is the difference between e.target and e.currenttarget?
- Theory + practice will help you master the dynamic programming method
- Pytorch common parameter initialization methods: [uniform distribution, normal (Gaussian) distribution, Xavier, Kaiming, orthogonal matrix, sparse matrix, constant, identity matrix, zero filling]
- lua 日期时间
- Lua conditional statement
猜你喜欢

Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!

2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試

Dry goods sharing | BitSet application details

OpenCV源代码编译

CST learning: four element array design of circular patch antenna (III) array formation and parallel excitation

模型过拟合-解决方案(二):Dropout

2022起重机械指挥上岗证题目模拟考试平台操作

基于Three.js海上风电数字孪生三维效果

2202 resume making

Operation of simulation test platform for G3 boiler water treatment test questions in 2022
随机推荐
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
[Yugong series] wechat applet in February 2022 - Reference
80 lines of code to realize simple rxjs
[opencv learning] use the Tesseract OCR movement to recognize numbers
CV—BaseLine总结(从AlexNet到SENet的发展历程)
CST learning: four element array design of circular patch antenna (II) array formation and combination results
[North Asia data recovery] data recovery cases in which the partitions disappear and the partitions are inaccessible after the server reinstalls the system
Module 8 operation
Chapter 8 - shared model JUC
[kubernetes guide ④] pod quick start
〖Kubernetes指南⑤〗Label快速入门
Printf segment error (core dump): a problem caused by formatted output
Avoid using asp Net core 3.0 to inject services for startup classes
Abstract methods and abstract classes
Industry reshuffle, a large number of programmers are going to lose their jobs? How can we break the current workplace dilemma
Novice must see! How rust beginners write gear smart contracts (1)
Go time format assignment
Hongmeng starts
基于Three.js海上风电数字孪生三维效果
妙才周刊 - 5