Answers for "python convert list element to string"

2

convert all items in list to string python

mylist = [str(i) for i in mylist]
Posted by: Guest on January-18-2021
0

python list to string

# Python list to string

some_list = ['Bob', 'has', 'four', 'dogs'] # the base list

list_to_string = ' '.join(some_list) # using the join() we can join the list into a string
# the ' ' in the start is the way we want to connect the list
# if we will do '/' the string will look like Bob/has/four/dogs

print(list_ro_string) # Prints the string

===============================================================
# Output:

>>> 'Bob has four dogs'
Posted by: Guest on January-09-2021

Code answers related to "python convert list element to string"

Python Answers by Framework

Browse Popular Code Answers by Language