Skip to content

Instantly share code, notes, and snippets.

@reiki4040
Created September 15, 2014 11:15
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 reiki4040/4e7e30355ebeba584550 to your computer and use it in GitHub Desktop.
Save reiki4040/4e7e30355ebeba584550 to your computer and use it in GitHub Desktop.
example variable arguments for python.
import sys
def PrintStrings(*strings):
for s in strings:
sys.stdout.write(s)
print
def main():
PrintStrings("a", "b", "c")
alphabet = ["a", "b", "c"]
# error
# PrintStrings(alphabet)
PrintStrings(*alphabet)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment