[Tutor] Searching through text

samhar zghaier samharzghaier at gmail.com
Mon Nov 18 06:23:09 EST 2019


Hello again

Since last time my text was not clear enough i will give a new try

I'm trying to build a mini-library where i will be able to search by book
title and writer amongst other things

I thought that i would start by storing my books in a text file that will
look something like this
Book name, writer, number (to make choosing a bit easier)

Due to the fact that i'm going to search through the entire text file
multiple times i thought of writing a function
Would you guys help me write a function to search through the text please
This is how i am reading the text:


def split_text():
  list_of_everything = []
    with open(file_name) as file:
        for line in file:
            list_of_everything.append(line.strip())


More information about the Tutor mailing list