| Store | Cart

Iterating over tuple entries in a list

From: kosh <k...@aesaeion.com>
Wed, 10 Mar 2004 14:25:29 -0700
On Wednesday 10 March 2004 02:09 pm, Dirk Zimmermann wrote:
> Hi,>> I have the following problem:>> I have a list with tuples in it, looking like this:>> myList = [(1.1, "file1"), (1.2,"file2), (1.9, "file3")]>> (I want to store a number calculated from a file together with the> file.) Than I want to use functions expecting a list of floats. Is there> an easy way to slice myList? I know, that:

floats = [number for number,filename in myList]

Recent Messages in this Thread
Dirk Zimmermann Mar 10, 2004 09:09 pm
kosh Mar 10, 2004 09:25 pm
Messages in this thread