how to convert UNICODE to integer in Python?

Fredrik Lundh fredrik at pythonware.com
Fri Oct 6 06:59:14 EDT 2006


kath wrote:

>     xldays = int(xldate)
> ValueError: invalid literal for int(): Date
> 
> because xlrd.xldate_as_tuple() function expects first argument to be an
> integer. How do I convert an unicode character to integer, so that I
> could get the date using xlrd.xldate_as_tuple() function.

the error doesn't say anything about Unicode characters, it says that 
someone's passing the string "Date" to the int() function.

 >>> int("Date")
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): Date

</F>




More information about the Python-list mailing list