Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert a string into a list

str1 = "1 3 5 7 9"
list1 = str1.split()
map_object = map(int, list1)//Here we can turn the string into an int list

listofint = list(map_object)
print(listofint)
#result is [1, 3, 5, 7, 9]
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #convert #string #list
ADD COMMENT
Topic
Name
5+5 =