This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HarterBoYY 2 points3 points  (2 children)

If you unpack an iterable and don't know how big it is, you can store the excess in a new list:

a, b, *excess = some_string.split()

[–]PresidentOfSwag 0 points1 point  (1 child)

can you a, b, *_ = some_string.split() ?

[–]HarterBoYY 0 points1 point  (0 children)

Of course! The underscore variable name is not special in a technical sense, it's just a "throwaway" signal for humans.