473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

question about output

i have printed out some numbers and they look like

10944800e
10952560d

....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".

thanks.

Oct 5 '05 #1
4 1056
doh! nevermind, my original output had e and d in it.

Oct 5 '05 #2
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.

Oct 5 '05 #3
Given that the format is consistent (and the last char is not part of
the number you want), you can probably do something like this:

x = int('10944800e'[:-1])

Disclaimer: I am a n00b. YMMV ;-)

Oct 5 '05 #4
On 5 Oct 2005 07:24:31 -0700, "Java and Swing" <co*******@gmail.com>
declaimed the following in comp.lang.python:
i have printed out some numbers and they look like

10944800e
10952560d
What did you use to print them out -- that will tell us how to read
them...

For example, if the above had a 0 behind the "e" or "d"...
a = "10944800e"
b = "10952560d"
print float(a) Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: invalid literal for float(): 10944800e a = "10944800e0"
print float(a) 10944800.0 b = "10952560d0"
print float(b) 10952560.0


-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Oct 5 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: glen_stark | last post by:
maybe this is more an iostream question. I would like to output a value to a console in the following manner: value: xx Where xx gets updated dynamically. Is it possible using std C++ to...
5
by: ask | last post by:
Hi NG I'm a bit new to programming c# and have a question regarding ftp by the command prompt. As far as I can see it should be possible to start a process and pipe command streams into it. But...
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
3
by: Ken H | last post by:
Hi I have a question about architecting solutions.. I have a part of a project which requires me to track person details (name, addresses, etc... Should I be creating Person objects, Address...
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
18
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
4
by: maria | last post by:
I only use C++ with Visual Studio 6.0 for string manipulations in thousands of HTML pages on my website. Many times, the output files of many of my C++ programs contain a spanish question mark (¿)...
9
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I'm running a process from my application and using streamReader to read it's output. the file i'm running, writes some output to the screen and exceute another program. I'm write the...
2
by: Ken Fine | last post by:
I have a question about ASP.NET output caching. I want to use screen scraping as a temporary hack to pull in some complex Classic ASP-rendered content into some ASP.NET pages: protected String...
13
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.