Skip to content

Instantly share code, notes, and snippets.

@CSEmbree
Created October 14, 2013 03:54
Show Gist options
  • Save CSEmbree/6970482 to your computer and use it in GitHub Desktop.
Save CSEmbree/6970482 to your computer and use it in GitHub Desktop.
hello world code in Python
#!/usr/bin/python
# Run with:
# python hello.py cameron
# python hello.py
# import modules used here -- sys is a very standard one
import sys
# Gather our code in a main() function
def main():
print 'Number of arguments: ', len(sys.argv)
if len(sys.argv)>1:
print '\tHello there', sys.argv[1]
else:
print "\tHello world!"
# Standard boilerplate to call the main() function to begin
# the program.
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment