I have a script I\'m working on where I need to accept multiple arguments and then iterate over them to perform actions. I started down the path of defining a function and u
>>> def foo(x, *args): ... print "x:", x ... for arg in args: # iterating! notice args is not proceeded by an asterisk. ... print arg ... >>> foo(1, 2, 3, 4, 5) x: 1 2 3 4 5
edit: See also How to use *args and **kwargs in Python (As referenced by Jeremy D and subhacom).