0
How can I have *args and another parameter after?
Like let's say I have an array with numbers [1, 2, 3, 4, etc.] and I want to get all of them except the last one in the *args and the last one in another arg. How can I do that?
4 Answers
+ 4
args = args[:-1] # every arg but the last
args.append(<whatever>) # put whatever on the end
+ 1
According to the Tutorial, Python Core 95.1:
The parameter *args must come after the named parameters to a function.
The name args is just a convention; you can choose to use another.
+ 1
Rik Wittkopp I just saw that but thank you.
+ 1
Slick Thank you