[Tutor] Searching through text

Adam Eyring adameyring at gmail.com
Mon Nov 18 09:13:27 EST 2019


Hi,
You might want to search through this free online book for some answers.
The pattern matching chapter may be what you're looking for.
https://automatetheboringstuff.com/

AME

On Mon, Nov 18, 2019 at 6:23 AM samhar zghaier <samharzghaier at gmail.com>
wrote:

> 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())
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list