Python Split() and re.split()
<p>I'm looking to get a program to read a string/file and display the first three words in it.</p>

<p>So I tried:</p>

<pre><code>letter= "a,b,c"
print(letter.split(',')[0])
</code></pre>

<p>That worked to get one word, but doing [0,1,2] doesn't work as it doesn't accept tuples.</p>

<p>I read about using re.split, but I could only manage this:</p>

<pre><code>import re
letter= "a,b,c"
words = re.split((','), letter,)
print(words)
</code></pre>

<p>That displayed all letters, but I couldn't work out how to only specify 0,1 and 2. Any help would be much appreciated.</p>

<p>EDIT:
How can I get it to treat each letter seperate for input into an array? It treats them all as one.</p>