-3

I have a string that consists of numbers with a space.

myString = "3 45 12"

I want to make a list of integer values derived from that string, ex:

myList = [3, 45, 12]
bit_scientist
  • 1,496
  • 2
  • 15
  • 34

1 Answers1

3

Try this:

myString = "3 45 12"
numericdata = myString.split(' ')
numbers = []

for i in numericdata:
    numbers.append(int(i))

print(numbers)
Abdullah Ahmed Ghaznavi
  • 1,978
  • 3
  • 17
  • 27