Re: How to convert a list of strings to a tuple of floats?

2009-05-18 Thread Mike Kazantsev
On Mon, 18 May 2009 00:51:43 -0700 (PDT) "boblat...@googlemail.com" wrote: > this is the conversion I'm looking for: > > ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) Since itertools are useful in nearly every module and probably are imported already... import itertools as it ftuple = tuple(it.

Re: How to convert a list of strings to a tuple of floats?

2009-05-18 Thread Ben Finney
"boblat...@googlemail.com" writes: > Hello group, > > this is the conversion I'm looking for: > > ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) > > Currently I'm "disassembling" the list by hand, like this: > > fields = line.split('; ') > for x in range(len(fields)): > fields[x] =

Re: How to convert a list of strings to a tuple of floats?

2009-05-18 Thread Ulrich Eckhardt
boblat...@googlemail.com wrote: > this is the conversion I'm looking for: > > ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) > > Currently I'm "disassembling" the list by hand, like this: > > fields = line.split('; ') > for x in range(len(fields)): > fields[x] = float(fields[x]) >

Re: How to convert a list of strings to a tuple of floats?

2009-05-18 Thread Chris Rebert
On Mon, May 18, 2009 at 12:51 AM, boblat...@googlemail.com wrote: > Hello group, > > this is the conversion I'm looking for: > > ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) > > Currently I'm "disassembling" the list by hand, like this: > >    fields = line.split('; ') >    for x in range(len(fields))

Re: How to convert a list of strings to a tuple of floats?

2009-05-18 Thread alex23
On May 18, 5:51 pm, "boblat...@googlemail.com" wrote: > ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) > > Currently I'm "disassembling" the list by hand, like this: > >     fields = line.split('; ') >     for x in range(len(fields)): >         fields[x] = float(fields[x]) >     ftuple = tuple(fields) >

How to convert a list of strings to a tuple of floats?

2009-05-18 Thread boblat...@googlemail.com
Hello group, this is the conversion I'm looking for: ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) Currently I'm "disassembling" the list by hand, like this: fields = line.split('; ') for x in range(len(fields)): fields[x] = float(fields[x]) ftuple = tuple(fields) Of course it w