title: How to read data from txt file in python
body: <p>I have a names and numbers in my file (name of the file 'phone_book') and I tried to read all data using this code: </p>
  
  <pre><code>def read_phonebook():
      read = open("phone_book.txt", 'r')
      i = 0
      for i in (len(read)):
          print(i + '\t')
  
      read.close()
  
  while True:
  if menu == 2:
      read_phonebook()
  </code></pre>
  
  <p>but it gives Error: read_phonebook file has no len()</p>
  
  <p>If I don't use len it keeps printing data because I'm using While loop.
  Could someone explain me how can I make this function to read list's whole data? with using While Loop?  </p>