Skip to content

Instantly share code, notes, and snippets.

@milkbread
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milkbread/9386211 to your computer and use it in GitHub Desktop.
Save milkbread/9386211 to your computer and use it in GitHub Desktop.
Python: simple example on *args and **kwargs
#!/usr/bin/env python
def func(arg, *args, **kwargs):
print arg
if args:
print args
if kwargs:
print kwargs
def main():
func('hello')
func('hello', 1, 3, '5')
func('hello', 1, 3, '5', key1=7, key2=9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment