Advertisement
tomleo

Unpacking Py3 3

Mar 9th, 2013
2,917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PyCon 0.19 KB | None | 0 0
  1. >>> l
  2. [0, 1, 2, 3, 4]
  3. >>> first, *middle, last = l
  4. >>> first
  5. 0
  6. >>> middle
  7. [1, 2, 3]
  8. >>> last
  9. 4
  10. >>> l = [1,2]
  11. >>> first, *middle, last = l
  12. >>> first
  13. 1
  14. >>> middle
  15. []
  16. >>> last
  17. 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement