problem moving from char to integer

Melih Onvural melih.onvural at gmail.com
Tue Sep 26 19:23:28 EDT 2006


This is the error message that I'm having a tough time interpreting:
Traceback (most recent call last):
  File "pagerank.py", line 101, in ?
    main()
  File "pagerank.py", line 96, in main
    ch = strord(url)
  File "pagerank.py", line 81, in strord
    result[counter] = int(i);
ValueError: invalid literal for int(): i

and here is the full code:

def strord(url):
    counter=0;
    for i in url:
       result[counter] = int(i);
       counter += 1;

    return result;

Thanks

Pontus Ekberg wrote:
> Melih Onvural wrote:
>
> > Group,
> >
> > I'm trying to get a very basic cast from a string to an integer
> > working. Here is what I'm doing:
> >
> > for i in url:
> >      result[counter] = int(i)
> >      counter += 1;
> >
> > return result;
> >
> > anything that I'm doing drastically wrong? Mac OS 10.4, MacPython
> > upgraded to 2.4. Thanks for any help,
> >
> > Melih
>
> In what way does it not work? Please post the entire code or at least the
> result of your code.




More information about the Python-list mailing list