newbe how to read in a string?

William Famy william.famy at noos.fr
Fri Mar 23 21:20:53 CET 2001


Thanks for the answer. I will use map now ;-)

I am using python 1.5.2 runing on a sid debian. I don't know python 2.0
or more.

William

Chris Gonnerman wrote:
> 
> BZZT!  The given string starts with a date which will cause float()
> to throw a ValueError.
> 
> I might say:
> 
>     seq = string.split(a, ",")
>     seq[2:] = map(float, seq[2:])
> 
> > List comprehensions are great, but when you DO want to get
> > map's primary job (applying an already-existing function
> > to parameter sequences) map is still best (with list
> > comprehension, you can avoid using _lambda_ just in order
> > to be able to use map -- I think eschewing lambda makes
> > your code clearer, but maybe that's just me).
_____________________________________________________________

I do not know lambda. I will look for it.


 
> No argument here.  I work in both 1.5.2 and 2.0 and rarely miss
> the 2.0 features, and I'm in the camp that finds ','.split(a)
> ugly.
___________________________________________________________
I do not understand the problem. perhaps later ;-)

  I don't like lambda and avoid it whenever possible.
> 

-- 
 			     \\\|///
                           \\  - -  //
                            (  @ @  )
+-------------------------oOOo-(_)-oOOo-------------------------+
|  Famy William  36 avenue des barattes  74000 Annecy  France   |
|  email:william.famy at noos.fr william.famy at mail-enseignant.com  |
+---------------------------------Oooo--------------------------+
                           oooO   (   )
                          (   )    ) /
                           \ (    (_/
                            \_)



More information about the Python-list mailing list