Re: string concatenate

2008-10-01 Thread Terry Reedy
sandric ionut wrote: I have the following situation: nameAll = [] for i in range(1,10,1): n = "name" + str([i]) nameAll += n print nameAll nameAll = [] for i in range(1,11): n = "name" + str(i) nameAll.append(n) print(' '.join(nameAll)) #3.0 #prints name1 na

Re: string concatenate

2008-10-01 Thread Lie Ryan
On Wed, 01 Oct 2008 09:41:57 -0700, sandric ionut wrote: > Hi: > > I have the following situation: >     nameAll = [] Here you defined nameAll as a list >     for i in range(1,10,1): That range is superfluous, you could write this instead[1]: for i in range(10): >     n = "name" + str([i])

Re: string concatenate

2008-10-01 Thread D'Arcy J.M. Cain
On Wed, 1 Oct 2008 09:41:57 -0700 (PDT) sandric ionut <[EMAIL PROTECTED]> wrote: > Hi: > > I have the following situation: >     nameAll = [] >     for i in range(1,10,1): >     n = "name" + str([i]) >     nameAll += n >     print nameAll > > I get: > > ['n', 'a', 'm', 'e', '[', '1', ']'

Re: string concatenate

2008-10-01 Thread Tommy Grav
On Oct 1, 2008, at 12:41 PM, sandric ionut wrote: Hi: I have the following situation: nameAll = [] for i in range(1,10,1): n = "name" + str([i]) nameAll += n print nameAll I get: ['n', 'a', 'm', 'e', '[', '1', ']', 'n', 'a', 'm', 'e', '[', '2', ']', 'n', 'a', 'm