Jump to content

User:Msiddalingaiah/Python snippets

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Msiddalingaiah (talk | contribs) at 15:34, 23 March 2005 (Added comment). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A short collection of Python code snippets

Main function

if __name__ == "__main__":
    main()

Command line arguments

import sys
for arg in sys.argv:
    print arg

sys.argv[0] is the command, sys.argv[1] is the first argument proper.