Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there. I'm new to programming in general but have made some simple to moderate programs before. What I'm currently struggling to figure out is how I would create a program that would allow me to search for a specific book defined by the author, year of publication, paper title or name of journal or conference within a text file of books and output the book, output an error message saying the book doesn't exits or output an error message if the user doesn't input all the information. I'm not simply asking for someone to write the entire code for me, but rather give me an indication as to how I could start with this, explain what functions I would need to use, or to point me to a website where I could find relevant information to help with this.
Posted
Updated 6-May-15 4:54am
v2

1 solution

If it is a simple text file, then you would need to read it line by line with https://docs.python.org/3.3/distutils/apiref.html?highlight=text%20file%20read#module-distutils.text_file[^]. Then you would have to read each line and search for the specific fields in that line until you get a match.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900