Convert list to string

I have this list:

scores = [
    ('WillyCaballero', '2'),
    ('Angeleri', '2'),
    ('Antunes', '2'),
    ('FlavioFerreira', '2'),
    ('Camacho', '2'),
    ('SamuGarc\xc3\xada', '2'),
    ('I\xc3\xb1igoMart\xc3\xadnez', '2'),
    ('Jos\xc3\xa9\xc3\x81ngel', '6')
    ...
]

How to store str in one variable and display how this format is ?:

Willy Caballero 2   
Angeleri 2  
Antunes 2  
...
+3
source share
5 answers

Using str.join, first attach the elements with whitespace, and then with'\n'

In [25]: print '\n'.join(' '.join(s) for s in scores)
Willy Caballero 2
Angeleri 2
Antunes 2
Flavio Ferreira 2
...
+6
source
str = '\n'.join(' '.join(s) for s in scores)
print(str)
0
source
for i in scores:
    print i[0],i[1]
0
source

Edited

>>> out = map ('' .join, p)
>>> for i in out:
... print i
... 
WillyCaballero 2
Angeleri 2
Antunes 2
>>> 
0
source

I would do this:

scoresList = ''
for score in scores:
   scoresList += ' '.join(score) + '\n'
#end loop
0
source

All Articles