string concatenate

Terry Reedy tjreedy at udel.edu
Wed Oct 1 16:33:37 EDT 2008


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 name2 name3 name4 name5 name6 name7 name8 name9 name10
#as you requested




More information about the Python-list mailing list