Question: Complete beginner question here, but after scouring this site and the internet for several hours, I still can't come up with a reason as to why I am getting this error. 

I am trying to use `.split()` to get all the integers out of a `.txt` file with a simple python program. I want to learn how to do this so I can start to tackle more complex tasks. This is what I have so far.

```
import sys
test = open(sys.argv[1], 'r')

for num in test:
    answer = [int(x) for x in num.split()]
    print answer

```

Every time I try to enter this at the command prompt `python test.py test.txt` I get invalid literal for `int()` error message. My `test.txt` file is a single line file formatted like so:

`1 10 20 30 40 50 60 70 80 90 100`

Each number is separated by a single space.

Am I going about this the wrong way?

Edit: I just realized I should say that I am using notepad++ to write these python programs, and the windows 8 powershell to run and test them.

Edit: I created a brand new .txt file called test1.txt and the code works. I am saving my original test.txt file because the problem is interesting and a solution technically wasn't found. If it means anything, I created test.txt using an echo command in powershell so, echo "1 10 20 30 40 50 60 70 80 90 100">test.txt and the new test1.txt file inside notepad++

Answer: 
Probably you're facing problem with new line chars in the last column of each line. Not sure but removing leading and trailing characters for each line might solve:

```
for num in test:
    num = num.strip()
    answer = [int(x) for x in num.split()]   
    print answer

```
If each number is separated by a single space then add that space to your split command:

```
[int(x) for x in line.split(' ')]

```