Type mismatchings and the rank newbie
Timothy Grant
tjg at exceptionalminds.com
Fri Mar 16 17:49:26 EST 2001
On Fri, Mar 16, 2001 at 10:21:18PM +0000, John Brawley wrote:
> Rank newbie here, trying to do something specific.
> I need to use a set of numbers (say, 1 to 25), and create 25 lists from the
> numbers (1 thru 25), which lists have a character "P" and a number (one of
> the 25).
>
> The lists I want look like :
> P1=[x, y, z]
> P2=[x, y, z]
> P3=[x, y, z]
> (etcetera down to P25)
I'm not completely sure I understand the question, but you
might try something like this...
exec 'P%s=[%s,%s,%s]' %(1,'x','y','z')
This will create and execute a python statement that looks like
this...
P1=[x,y,z]
However, I do believe that you best bet would be to use a
dictionary...
P = {}
P[1] = [x,y,z]
P[2] = [x,y,z]
P[3] = [x,y,z]
--
Stand Fast,
tjg.
Timothy Grant tjg at exceptionalminds.com
Red Hat Certified Engineer www.exceptionalminds.com
Avalon Technology Group, Inc. <>< (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted: 59 days 3:00 hours ago<<
More information about the Python-list
mailing list