Python 3.x can do this easily:
a, b, *c = someseq
Python 2.x needs a bit more work:
(a, b), c = someseq[:2], someseq[2:]
More Related Contents:
- What is the difference between shallow copy, deepcopy and normal assignment operation?
- Multiple assignment and evaluation order in Python
- Local variable referenced before assignment?
- What is the difference between slice assignment that slices the whole list and direct assignment?
- Assignment inside lambda expression in Python
- How to assign a value to a TensorFlow variable?
- Multiple assignment semantics
- If two variables point to the same object, why doesn’t reassigning one variable affect the other?
- How does Python’s comma operator work during assignment?
- Why isn’t assigning to an empty list (e.g. [] = “”) an error?
- Python Assignment Operator Precedence – (a, b) = a[b] = {}, 5
- Is it possible only to declare a variable without assigning any value in Python?
- assigning class variable as default value to class method argument
- What is this kind of assignment in Python called? a = b = True
- Simultaneous assignment semantics in Python
- How to assign a variable in an IF condition, and then return it?
- Is a variable the name, the value, or the memory location?
- Python: setting two variable values separated by a comma in python
- How to make a copy of a 2D array in Python? [duplicate]
- Why does foo = filter(…) return a , not a list? [duplicate]
- What does an ‘x = y or z’ assignment do in Python?
- can anyone solve it for me [closed]
- Maximum and Minimum values for ints
- How do I disable a Pylint warning?
- error installing psycopg2, library not found for -lssl
- Merging Overlapping Intervals
- How do I detect whether a variable is a function?
- python abstractmethod with another baseclass breaks abstract functionality
- Numpy minimum in (row, column) format
- Overlap between mask and fired beams in Pygame [AI car model vision]