+ 1
question about python
how can I make a string from a list?
5 ответов
+ 10
What do you mean? Do you mean like this?
lst = ["s", "o", "l", "o", "l", "e", "a", "r", "n"]
print("".join(x for x in lst))
#prints sololearn
lst2 = ["solo", "learn"]
print("".join(x for x in lst2))
#prints sololearn
+ 1
Thank you
0
Thank you!
0
There is an useful method for that.
"".join.(list)
But another way is:
string = ""
for i in list:
string += i
0
If you need list of the available list or string methods and functions type dir(list) or dir(str), you may also type help() for Python's large documentation.