[Tutor] Arguments from the command line

bob gailer bgailer at gmail.com
Mon Sep 6 12:20:12 EDT 2010


  On 9/6/2010 11:48 AM, aug dawg wrote:
> I've seen Python programs that can be activated from the command line. 
> For example:
>
> hg
>
> This displays a list of commands for the Mercurial revision control 
> system. But another command is this:
>
> hg commit "This is a commit name"
>
> Mercurial is written in Python. I know that commit is a function that 
> commits to a repo, but what command does the program use in order to 
> get the commit name, like "This is a commit name" (This would make a 
> commit with "This is a commit name" as the commit name)
hg.py:
import sys
print sys.argv

$hg commit "This is a commit name"
['C:\\hg.py', 'commit', 'This is a commit name']

-- 
Bob Gailer
919-636-4239
Chapel Hill NC




More information about the Python-list mailing list