Created
September 15, 2014 11:15
-
-
Save reiki4040/4e7e30355ebeba584550 to your computer and use it in GitHub Desktop.
example variable arguments for python.
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
import sys | |
def PrintStrings(*strings): | |
for s in strings: | |
sys.stdout.write(s) | |
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