title: How can i code a function that can read a text file and write into a list?
body: <p>How can i code a function that can read a text file append it into a list 
  thank in advance.
  i tried this but it won't work .</p>
  
  <pre><code>def readdata (z):
  x=[ ]
  for dig in open(z).readlines():
      digx=dig.strip().split(" ")
      if len(dig) == 0:
          print 
          return 0
  
      else :
          return x.append(str(digx))
          print x
   readdata (r'C:\Users\Administrator\Coding\Python\Text\Day5\scores.txt')
  </code></pre>