Extracting float from string

Bjorn Pettersen BPettersen at NAREX.com
Tue Jan 14 06:00:03 CET 2003


> From: Peter Hansen [mailto:peter at engcorp.com] 
> 
> Spencer Ernest Doidge wrote:
> > 
> > From a previous post,
> > I got many good solutions to extracting an int from
> > 'X= 445 A'.
> > 
> > Now what about this one?
> > Somewhere (we don't know where) in this input string, we 
> > expect to find a float:
> > ':X=  0.22456  A'
> > 
> > How can I suck the float out of this one?
> 
> Since you aren't giving almost any more information about this one
> than the last... I'm not going to play any more.
> 
> (If you hadn't noticed, you got exactly seven earnest 
> attempts (so far)
> at helping you out in spite of a *pitifully inadequate* specification
> of your requirements.
[...]

Spencer: it might be insightful for you to read
http://www.tuxedo.org/~esr/faqs/smart-questions.html. People on c.l.py
are friendly to all newcommers, but probably even more friendly (or at
least give better answers) you they ask "Smart Questions" <wink>.

-- bjorn





More information about the Python-list mailing list