[Zope] [python] creating variable names by adding 2 strings?

Lee lee.reilly@ntlworld.com
Mon, 22 Jan 2001 03:24:21 +0000


Hi there,

I'm creating variables in python but I am having trouble creating them
when they're *named* using other variables. Here's an example;

while (p!=0):
     	p+`p`= string.replace(component[control], ",", "") 
	# e.g. I want 'p1 = string.replace.blah...'
    	p=p-1
    	control=control+1

==> SyntaxError: can't assign to operator :(

I've tried various things but I cannot find a solution. I've got a nasty
feeling that it's not possible...

If someone could confirm this or hopefully, tell me how to do it I would
be_extremely_grateful.

Thanks,

Lee (crossing his fingers)