string concatenate

sandric ionut sandricionut at yahoo.com
Wed Oct 1 12:41:57 EDT 2008


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', 'e', '[', '3', ']', 'n', 'a', 'm', 'e', '[', '4', ']', 'n', 'a', 'm', 'e', '[', '5', ']', 'n', 'a', 'm', 'e', '[', '6', ']', 'n', 'a', 'm', 'e', '[', '7', ']', 'n', 'a', 'm', 'e', '[', '8', ']', 'n', 'a', 'm', 'e', '[', '9', ']']

but I would like to have it as:

name1 name2 name3 ...name10

How can I do it?

Thank you,

Ionut


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081001/4d1da223/attachment.html>


More information about the Python-list mailing list