question about output
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Wed Oct 5 10:59:38 EDT 2005
On Wed, 05 Oct 2005 07:24:31 -0700, Java and Swing wrote:
> i have printed out some numbers and they look like
>
> 10944800e
> 10952560d
They don't look like numbers to me. They have letters at the end. What are
they? What does the letter mean?
> ...if i want to later assign this type of number to variable how can i
> do it?
>
> for example i can't do...
>
>>> x = 10944800e
>
> ..since it says "invalid token" on the "e".
How did you get the "numbers"? If you just typed them in by hand, then
leave the "e" off and you have a number.
If they are supposed to be hex numbers, then you can use:
x = int("10944800e", 16) # note the quote marks
print x
-> 4450451470
If you don't care about the numeric value, then you just put quote marks
around the number+letter:
x = "10944800e"
but then x will be a string, not a number.
If none of these answers is what you need, you will need to explain your
problem a little better.
--
Steven.
More information about the Python-list
mailing list