We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 447c760 commit 238d6f7Copy full SHA for 238d6f7
1 file changed
README.md
@@ -1220,6 +1220,29 @@ strace -p [pid] -tt -s 1024 -o /tmp/[pid].log
1220
```
1221
1222
1223
+## 理解 tuple (元祖)
1224
+
1225
+为什么当tuple只有一个item时,需要加逗号
1226
1227
+```
1228
+In [1]: (3+4)*5
1229
+Out[1]: 35
1230
1231
+In [2]: (3+4,)*5
1232
+Out[2]: (7, 7, 7, 7, 7)
1233
1234
1235
1236
+In [3]: type(('fuck'))
1237
+Out[3]: str
1238
1239
+In [4]: type(('fuck',))
1240
+Out[4]: tuple
1241
1242
1243
+Not the parentheses make the tuple, the commas do.
1244
1245
1246
## 文档托管
1247
1248
Read the Docs
0 commit comments