March 31st, 2005, 08:09 PM
I've having a bit of a problem doing something in Python that Visual Basic 6 has the capability of. I need Python to do:
I just made up a number with the correct length. Python will return the following error:
int('0x' + '1234567890123'[:3])
I want Python to return:
Traceback (most recent call last):
File "<pyshell#26>", line 1, in ?
ValueError: invalid literal for int(): 0x
But, I can do:
The problem is that Python isn't returning 291. I don't already know what the number is going to be, so there's no way to automatically know the first three digits of it. Is there another way to doing this?
March 31st, 2005, 09:26 PM
i don't know if this is the best way to do this but it works
March 31st, 2005, 09:39 PM
Thanks a lot jacktasia. This works just fine.
March 31st, 2005, 09:45 PM
Originally Posted by †Yegg†
March 31st, 2005, 09:46 PM
Oh. That works too.