Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python convert list to list of strings

# Basic syntax using list comprehension:
lsit_of_strings = [str(i) for i in your_list]

# Example usage:
your_list = ['strings', 'and', 'numbers', 11, 23, 42]
lsit_of_strings = [str(i) for i in your_list]
print(lsit_of_strings)
--> ['strings', 'and', 'numbers', '11', '23', '42'] # List of strings
Source by www.afternerd.com #
 
PREVIOUS NEXT
Tagged: #python #convert #list #list #strings
ADD COMMENT
Topic
Name
1+1 =