title: Error reading .txt and splitting a list with commas
body: <p>I'm developing a program that choose a random element from a list. The elements are stored in a .txt file separated with commas.</p>
  
  <p>Example: the .txt files contains</p>
  
  <pre><code>spam,eggs,bacon
  </code></pre>
  
  <p>So I use this code that returns a list with the 3 elements.</p>
  
  <pre><code>f = open("list.txt", "r")
  
  _list_raw = f.read()
  
  _list = (str(_list_raw))
  
  _list_split = _list.split(",")
  
  f.close()
  
  return _list_split
  </code></pre>
  
  <p>_list_split would be [spam, eggs, bacon]</p>
  
  <p>The problem is that if the .txt is empty, this function returns me a list of len = 1 which contains the element ''. I don't understand what is happening here.</p>
  
  <pre><code>expected result = [] len = 0
  obtained result =[''] len = 1
  </code></pre>
  
  <p>So this cause a lot of problems, if I append an element to this list, I obtain something like this in the .txt</p>
  
  <pre><code>,eggs,bacon
  </code></pre>
  
  <p>How can I solve this? Thank you!</p>