Creating A Tuple From A List, Adding To Tuple As You Do

Karsten Heymann karsten.heymann at blue-cable.net
Thu Jun 5 14:49:16 CEST 2008


Jeff Nyman <jeffnyman at gmail.com> writes:
> from glob import glob
> DC_List = glob('\\\\vcdcflx006\\Flex\\Sites\\*\\')
> DC_List = ['Baltimore', 'Birmingham', 'Cincinnati', 'Cleveland',
> LosAngeles']

> The problem is that I need to pass this list to a list control in a
> wxWidgets application. In order to do that, I need to pass in a list
> like this:
>
> [ ('Baltimore', ''), ('Birmingham', ''), ('Cincinnati', ''),
> ('Cleveland', ''), ('LosAngeles', '') ]

That's not hard:

[ (x,'') for x in DC_List ]

Yours
Karsten



More information about the Python-list mailing list