faqts : Computers : Programming : Languages : Python : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 2 people (50%) answered Yes
Recently 1 of 2 people (50%) answered Yes

Entry

how to pass arguments for a function in a command line

Jun 16th, 2004 03:13
Thomas Samson, chempaka biru,


You use sys.argv. For example: 
from sys import argv 
def main(arg_list): 
   for elem in arg_list: 
       print elem 
main(argv)