Mini Project on Contact Book
Project Title: Contact Book
Project Description:
The Contact Book is a simple application designed to store and manage contact information. It allows users to add, view, edit, and delete contacts.
Features:
Add Contact: Users can add a new contact with details such as name, phone number, email address, and any other relevant information.
View Contacts: Users can view a list of all contacts stored in the contact book.
Search Contacts: Users can search for a specific contact by name or any other criteria.
Edit Contact: Users can edit the details of an existing contact.
Delete Contact: Users can delete a contact from the contact book.
Save Contacts: Contacts should be saved persistently so that they are available even after the application is closed and reopened.
Technologies:
Language: Python
Interface: Command-line interface (CLI)
Data Storage: Text file (for simplicity)
Implementation:
Setup:
Create a Python script file for the Contact Book.
Create a text file to store contact information (e.g.,
contacts.txt
).
Main Menu:
Display options for Add, View, Search, Edit, and Delete contacts.
Prompt the user to choose an option and execute the corresponding functionality.
Add Contact:
Prompt the user to input contact details (name, phone number, email, etc.).
Append the contact information to the text file.
View Contacts:
- Read the contents of the text file and display them in a formatted manner.
Search Contacts:
Prompt the user to enter a search query (e.g., name).
Display contacts matching the search query.
Edit Contact:
Prompt the user to enter the name of the contact to be edited.
Display the contact details and allow the user to modify them.
Update the corresponding entry in the text file.
Delete Contact:
Prompt the user to enter the name of the contact to be deleted.
Remove the corresponding entry from the text file.
Save Contacts:
- Ensure that any changes made to contacts are saved back to the text file.
Error Handling:
- Implement error handling for invalid inputs and file operations.
Example Code Snippet (Add Contact):
def add_contact():
name = input("Enter name: ")
phone = input("Enter phone number: ")
email = input("Enter email address: ")
with open("contacts.txt", "a") as file:
file.write(f"{name},{phone},{email}\n")
print("Contact added successfully!")
Additional Features (Optional):
Sorting: Allow sorting contacts by name or other criteria.
Import/Export: Support importing and exporting contacts from/to CSV or other formats.
Multiple Address Books: Allow users to maintain multiple contact books (e.g., personal, work).
GUI Interface: Develop a graphical user interface (GUI) using libraries like Tkinter.
Conclusion:
The Contact Book project provides a basic yet functional application for managing contact information. It can be extended with additional features and improvements based on user requirements and feedback.
Watch Now:-https://www.youtube.com/watch?v=4sEfkbqDWJM&t=68s