[Tutor] sys.argv?

alan.gauld@bt.com alan.gauld@bt.com
Mon, 27 Nov 2000 17:22:41 -0000

> test(sys.argv[1], sys.argv[2])
> ./test.py Foo 3
> my problem is when I'm using sys.argv to pass in a number it 
> converts to a string.

No it doesn't, argv is a list of strings...

> Is there a way around this using sys.argv or do I 
> have to use string.atoi(n) to convert it back to int?


could be used, but you should wrap in try/except in 
case its not compatible and of course check that there 
are at least 2 arguments present!

Alan G.