[Tutor] sys.argv?

Scott Ralph Comboni scott@zenplex.com
Mon, 27 Nov 2000 10:57:48 -0500


Question about using sys.argv

Example of problem:

#!/usr/bin/env python
import sys

def test(name, n):
       print name, n + 1

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..  Is there a way around this using sys.argv or do I have to use 
string.atoi(n) to convert it back to int?
Most likely something stupid on my part.
Thanks Scott