Question

How A can be changed into B in python?

A = ['a.png', 'b.png', 'c.png', 'd.png', 'e.png']
B = 'a.png;b.png;c.png;d.png;e.png'
Was it helpful?

Solution 2

there's a function called join which might come to your rescue now:

try this:

b = ';'.join(a)`

in your case:

A = ['a.png', 'b.png', 'c.png', 'd.png', 'e.png']
B = ';'.join(A)
print b #this will return -> a.png;b.png;c.png;d.png;e.png

OTHER TIPS

Simple, use str.join():

>>> A = ['a.png', 'b.png', 'c.png', 'd.png', 'e.png']
>>> B = ';'.join(A)
>>> print(B)
a.png;b.png;c.png;d.png;e.png
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top