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:
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()
but it gives Error: read_phonebook file has no len()
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?