Skip to content

Instantly share code, notes, and snippets.

@jaraco
Created September 27, 2024 20:59
Show Gist options
  • Save jaraco/a0ee0de319fa152bc4084af1bba3885c to your computer and use it in GitHub Desktop.
Save jaraco/a0ee0de319fa152bc4084af1bba3885c to your computer and use it in GitHub Desktop.
Quick code examples demonstrating Python unpacking
Example 1.A - Multiple assignment using a list
>>> a, b, c = [1, 2, 3]
>>> a
1
>>> b
2
>>> c
3
Example 1.B: multiple assignment using any iterable
>>> a, b, c = (1, 2, 3)
>>> d, e, f = '456'
>>> a
1
>>> b
2
>>> c
3
>>> d
'4'
>>> e
'5'
>>> f
'6'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment