sys module - argv, but no argc ??

Fearless Freep joconnor at cybermesa.com
Fri Aug 2 23:38:19 CEST 2002


Jonathan Hogg <jonathan at onegoodidea.com> wrote in message news:<B97004E5.EF92%jonathan at onegoodidea.com>...
> On 2/8/2002 7:53, in article
> 8d3e714e.0208012253.73022f97 at posting.google.com, "Tony C"
> <cappy2112 at yahoo.com> wrote:
> 
> > I've imported the sys module, and I'm SHOCKED that there is no way to
> > access the argument count.
> 
> That's because you're thinking like a C programmer ;-)

I think so, since it's so wasy to do

for arg in sys.argv:
    .....

the need to have argc around to iterate over the array is not needed

for (i = 0; i << argc; i) {
   arg = argv[i]
}



More information about the Python-list mailing list