newbie question...

Tim Rowe digitig at
Fri Dec 12 21:07:42 CET 2008

2008/12/12  <trfilmographer at>:

> ah, ok.  now what if I want the variable to be an integer that I
> send?  for instance if I send 99 to the program, it is picking it up
> as a string instead of an integer value.  How do I handle this with
> python??

As 'r' has said, you can cast it to integer. In the real world you'd
want to handle the case where the user passes in something that isn't
an integer, or passes in nothing at all -- it's generally a good idea
to check anything the user enters for validity. It's possibly too
early for you to try to code it, but it's never too early to start
thinking about what you would /want/ it to do. What do you think it
will do for invalid or no command line arguments at the moment? Try

Tim Rowe

More information about the Python-list mailing list