How do i get list instead of list of list?
<p>I am trying to read a text file with the following format <code>"a b c d e f g h"</code>. I take a new empty list <code>word = []</code></p>

<p>My code is:</p>

<pre><code>f = open("letters.txt")

word = []

for line in f:
    line = line.split(" ")
    word.append(line)
print(word)
</code></pre>

<p>However, it has given me a list of list like this:</p>

<pre><code>[['a', 'b', 'c', 'd', 'e', 'f']]
</code></pre>

<p>But I want to get it in a single list instead?</p>

<p>eg:</p>

<pre><code>['a', 'b', 'c']
</code></pre>

<p>Try like this,</p>

<pre><code>word = open("letters.txt").read().split()
</code></pre>

<p><strong>Result</strong></p>

<pre><code>['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
</code></pre>

python list readfile