+ 1
Convert all element of list to string
for example list=[a,b,c] to list=['a','b','c'] a,b and c is not defined
3 Answers
+ 5
Slightly different answer using map ()
https://code.sololearn.com/cPpssx11uUyK/?ref=app
+ 4
Actually, "list" can't be the name of a list, but if you must use that name...
list = [str(x) for x in list]
should work, assuming a, b and c are variables.
+ 3
Okay, a better example will be
[1,2,3]
to
['1','2','3']
Use the map function.
map(whatever function you want, whatever iterable you want)
the function must be a lambda or an in-built function.
For example, map(lambda x:x+1,thatlistabove) will create a map object that stores [2,3,4] and to get your list back, use list().
For your query, I suggest you use
list(map(str,thatlistabove)).
#remember to store it!