hst at empolis.co.uk
Thu Nov 13 11:43:44 CET 2003
Angelo Secchi wrote
> I'm newby to Python with the following problem.
> In one of my programs I have the following loop:
> for index in markets:
> where markets is a list ['A','B','C']. In the same loop at each step I
> would like to create a new list with name 'firm_A', 'firm_B'
> and so on.
> How can I ask to python to do that?
pippo = 
for index in markets:
pippo.append('firm_' + index)
or the list comprehension
pippo = ['firm_ + index for index in markets]
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.
More information about the Python-list