1 | initial version |
First, you can get the list of values of P, viewed as strings as follows:
sage: sage: L = [str(i) for i in P]
sage: L
['1', '2', '3', '4']
Then you can join those strings with an empty separator:
sage: ''.join(L)
'1234'
Putting all together (and replacing the list with an iterator (by removing the brackets)) leads to:
sage: ''.join(str(i) for i in P)
'1234'