当前位置:网站首页>Application of list and Dict
Application of list and Dict
2022-06-12 13:07:00 【plzdonotlietome】
1. list There are several ways to expand the list ( Or the method of adding elements )
extend: Extend elements by iteratively appending


insert: Insert object before index

append: Append to the end

2. Yes ["cherry", "litchi", "strawberry", "mangosteen", "pomelo", "pineapple", "pitaya", "durian"] Default sort and sort using the third letter

3. dict Use of all methods in ( Write the source code first and then the sample )
clear(self): # real signature unknown; restored from __doc__
""" D.clear() -> None. Remove all items from D. """
Delete all items

opy(self): # real signature unknown; restored from __doc__
""" D.copy() -> a shallow copy of D """
Shallow copy

get(self, *args, **kwargs): # real signature unknown
""" Return the value for key if key is in the dictionary, else default. """
If key In the dictionary , Then return to key Value , Otherwise, return the default value

items(self): # real signature unknown; restored from __doc__
""" D.items() -> a set-like object providing a view on D's items "
A collection like object , Provides a view of the dictionary item


keys(self): # real signature unknown; restored from __doc__
""" D.keys() -> a set-like object providing a view on D's keys ""
A collection like object , Provide View on dictionary key

pop(self, k, d=None): # real signature unknown; restored from __doc__
"""
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
Delete the specified key and return the corresponding value

If key is not found, default is returned if given, otherwise KeyError is raised
If not found key, Then return to default( If a given ), Otherwise trigger KeyError


popitem(self, *args, **kwargs): # real signature unknown
"""
Remove and return a (key, value) pair as a 2-tuple.
Delete ( key 、 value ) To and as Binary return .

Pairs are returned in LIFO (last-in, first-out) order.
Press last in first out in pairs ( Last in, first out ) Sequential return
Raises KeyError if the dict is empty.
If the dictionary is empty , The cause KeyErro
setdefault(self, *args, **kwargs): # real signature unknown
"""
Insert key with a value of default if key is not in the dictionary.
If the key is not in the dictionary , Then insert the key with the default value .

Return the value for key if key is in the dictionary, else default.
""" If key In the dictionary , Then return to key Value , Otherwise, return the default value .

update(self, E=None, **F): # known special case of dict.update
"""
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
From the dictionary / Can the iteration E and F to update D


If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E Exist and have .keys() Method , For E Medium k:D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
If E Exist and lack .keys() Method , For E Medium k, v:D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
In any case , This is followed by : about F Medium k:D[k] = F[k]
values(self): # real signature unknown; restored from __doc__
""" D.values() -> an object providing a view on D's values """
In any case , This is followed by : about F Medium k:D[k] = F[k]

边栏推荐
猜你喜欢

嵌入式系統硬件構成-基於ARM的嵌入式開發板介紹

LeetCode滑动窗口刷题总结

The goods are full. You must take this knowledge

【刷题篇】抽牌获胜的概率

Microsoft Word tutorial, how to insert a header or footer in word?

Array -- seven array topics with double pointer technique

Pytoch official fast r-cnn source code analysis (I) -- feature extraction
![[wechat applet development] Part 1: development tool installation and program configuration](/img/a8/f4dcbde295ba7cf738d878464b3af0.png)
[wechat applet development] Part 1: development tool installation and program configuration

Online picture material

403 you don't have permission to access this resource
随机推荐
Stm32f1 and stm32cubeide programming examples - device driver -eeprom-at24c256 driver
【刷题篇】超级洗衣机
VTK image sequence mouse interactive flipping
Vant tab bar + pull-up loading + pull-down refresh demo van tabs + van pull refresh + van list demo
How to balance multiple losses in deep learning?
R语言ggplot2可视化:使用ggrepel包在线图(line plot)的尾端那个数据点添加数值标签(number label)
Overview of embedded system 3- development process, learning basis and methods of embedded system
JVM 运行时参数
微信web开发者工具使用教程,web开发问题
Structure matérielle du système embarqué - introduction du Conseil de développement embarqué basé sur arm
Help you with everything from the basics to the source code. Introduce the technology in detail
[cloud native | kubernetes] kubernetes networkpolicy
Openstack network
Volume mount and mirror creation
itk::SymmetricForcesDemonsRegistrationFilter
下一个职场演讲PPT的明星,会不会是此刻的你【完美总结】
Theoretical knowledge of improved DH parameters and standard DH parameters of manipulator
提升管道效率:你需要知道如何识别CI/CD管道中的主要障碍
Simple picture preview
Binary tree (program)