Skip to content

Commit 73d1534

Browse files
committed
Python3__函数
1 parent 379b5e3 commit 73d1534

2 files changed

Lines changed: 760 additions & 1 deletion

File tree

python2__关键字,容器及访问,循环.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,16 @@ sorted ['AI', 'Caffe', 'julyedu.com', 'sklearn', 'sklearn']
159159

160160
### 列表推导式
161161
定义:
162+
162163
列表推导式也叫列表解析式(list comprehension), 是利用现有列表创建新列表。
164+
163165
□ 这种可以非常简洁的方式来快速生成满足特定需求的列表,代码可读性强。
166+
164167
□ Python 的内部实现对列表推导式做了大量优化,可以保证很快的运行速度。
165168

166169
语法:
167170
[表达式for变量in列表]
171+
168172
[表达式for变量in列表if条件]
169173

170174

@@ -226,7 +230,9 @@ t1[-1] id: 4481289608
226230

227231
### 集合Set
228232
一组 key 的无序排列集合,因此无法用索引及切片访问。
233+
229234
主要作用:
235+
230236
□ 用于去重及集合间操作
231237

232238

@@ -274,9 +280,14 @@ False
274280
None
275281
```
276282

277-
278283
### 字典 Dictionary
279284

285+
字典这种数据结构,是把一个元素映射到另一个元素上, 可以简单理解为 k:v 对应。
286+
287+
key值的选取:
288+
289+
■ Key值必须是可被哈希的,也就是说 key 只能是数字,字符串或者元组
290+
280291

281292
```python
282293
#K:V对应

0 commit comments

Comments
 (0)