Can we transform a list into a string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can we transform a list into a string?

for example we have that list : name = ['D','J','A','B','E','R'] can I transform it to get the output 'DJABER'

21st Dec 2016, 1:59 PM
Djaber Meghar
Djaber Meghar - avatar
1 Answer
+ 2
Yes you can, try this : s="".join(name) s is exactly "DJABER" in general, str.join(list) returns a string in which the elements of the list have been joined by str separator, for example, to obtain the string "DxJxAxBxExR", use "x".join(name) good luck ☺ !
21st Dec 2016, 2:22 PM
A B