> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-with-apach-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-with-apach-spark/untitled-44.md).

# index

(base) dv6\@dv6:/tmp$ cat test.txt

1 2 3 4 5

6 7 8 9 10

with open('/tmp/test.txt','r') as fp:

```
while True:

    line=fp.readline\(\)

    if line:

        line=line.strip\('\n'\)

        print\(line.split\(' '\)\)

    else:

        break
```

It outputs below:

\['1', '2', '3', '4', '5']

\['6', '7', '8', '9', '10']

\['']
