0

I am trying to take in a string of numbers, such as:

1 2 3 4 55 33 15

and store them in a list as they appear so that I can operate on the items at each index in the list, but they aren't splitting and storing right. They store like:

1,2,3,4,5,5,3,3,1,5

which is not what I want. My current code is attached below. I thought they would store as:

1,2,3,4,5,55,33,15

I do convert them to ints later on and that works fine, this is just the part that I am stuck on.

numbersArrayTemp.append(userInput.readline().strip(' ').strip('\n'))


for item in numbersArrayTemp:
    print(item)
    Type = item.strip('\n')
    print(Type)
    j = item.replace(" ", '')

   numbersArrayString.extend(j)
PKconversion
  • 71
  • 1
  • 7

0 Answers0