sending an argument

Dave Reed dreed at
Sat Aug 3 00:34:36 CEST 2002

> From: Teja Sastry <kurugant at>
> Hi,
>      Could anybody please tell me on how to send an argument to the 
> python program when starting the program like we send argument to c++ 
> executable.  How to read the input entered along with the .py executable 
>  (like " 8000")
> Thanks,
> Teja Sastry

Almost the same as C/C++. Here's the template for all my Python
programs. You can then use argv and len(argv) instead of the C/C++

import sys

def main(argv):

if (__name__ == '__main__'):


More information about the Python-list mailing list