You can pass arguments when calling a python script:
Code:#!/usr/bin/python # # filename: testarg.py # import sys print 'the first argument passed to me is: %s' % (sys.argv[1])
Code:#!/usr/bin/python # # filename: passarg.py # # pass bob to testarg script import os my_cmd = './testarg.py bob' os.system(my_cmd)However, it seems this is ugly and your best bet is to make modules:Code:radar@saturn:~$ ./passarg.py the first argument passed to me is: bob
http://www.ibiblio.org/g2swap/byteof...d/modules.html


Reply With Quote

Bookmarks