how to convert UNICODE to integer in Python?

K

kath

Hi,

Traceback (most recent call last):
File "D:\Python23\Testing area\Python and Excel\xlrdRead.py", line
30, in ?
temp=xlrd.xldate_as_tuple(sh.cell_value(rowx=r,colx=c),0)
File "D:\PYTHON23\Lib\site-packages\xlrd\xldate.py", line 61, in
xldate_as_tuple
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.

Thank you,
kath.
 
F

Fredrik Lundh

kath said:
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.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: invalid literal for int(): Date

</F>
 
K

kath

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

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

</F>


Hi,

Thanks for reminding me. I was wrong.

Regards,
kath
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top