convert list of string to list of object python code example
Example 1: convert string to list python
# To split the string at every character use the list() function
word = 'abc'
L = list(word)
L
# Output:
# ['a', 'b', 'c']
# To split the string at a specific character use the split() function
word = 'a,b,c'
L = word.split(',')
L
# Output:
# ['a', 'b', 'c']
Example 2: how to change the type of a values in list from str to object python
>>> list_a = ['20.3', '35', '10', '6.74', '323']
>>> list_a = map(float, list_a)
>>> list_a[0]*2
40.6