find the error
Dave Angel
davea at davea.name
Sat Sep 13 19:26:36 EDT 2014
daoudimca at gmail.com Wrote in message:
> Dear friends when i used
> import urllib, re, sys
>
> symbol = sys.argv[1] >>> this function is show -->> symbol = sys.argv[1]
> IndexError: list index out of range
>
> kindly find the solution of this
>
sys.argv is filled in from the command line arguments. Perhaps
your script should protect itself by majing sure len (sys.argv)
is what's required, in this case at least 2. That way the user
gets a friendlier message when he omits the arguments.
By the way, you should simply copy/paste the entire stack trace.
When you paraphrase, you're likely to have a typo, or omit
something useful.
--
DaveA
More information about the Python-list
mailing list