Created
August 18, 2011 14:54
-
-
Save andrewsmedina/1154225 to your computer and use it in GitHub Desktop.
python *args, **kwargs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def teste(nome, idade): | |
... print nome, idade | |
... | |
>>> teste('andrews', 26) | |
andrews 26 | |
>>> teste(nome='andrews', idade=26) | |
andrews 26 | |
>>> lista = ['pacote', 200] | |
>>> teste(*lista) | |
pacote 200 | |
>>> dicionario = {'nome': 'sargento', 'idade': 134} | |
>>> teste(**dicionario) | |
sargento 134 | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment