def process_group(parsed):
((_, p), _) = parsed
return p
说这个函数是用来去括号的,这左边到底是个啥? 正则,函数式?怎么表达式还能写左边,看不懂啊。。。。
1
c 2015-12-16 13:58:52 +08:00 2
解包
>>> parsed = ((1, 2), 3) >>> ((_, p), _) = parsed >>> p 2 |
2
linnchord 2015-12-16 14:02:59 +08:00 2
```
>>> a, b = (1, 2) >>> print a, b 1 2 >>> a, b = ((3, 4), 2) >>> print a, b (3, 4) 2 >>> ((a, c), b) = ((3,4), 2) >>> print a, b, c 3 2 4 ``` |
3
wwxiong 2015-12-17 09:27:31 +08:00
元组赋值而已
|