Welcome to the Python To-Do List Application! This program allows you to manage your tasks using a simple command-line interface, with tasks stored in an SQLite database for persistence.
- Add Tasks 🆕: Easily add tasks to your to-do list.
- View Tasks 📋: Display all tasks in a clear, formatted list.
- Delete Tasks 🗑️: Remove tasks from your list.
- Persistent Storage 💾: Tasks are saved in an SQLite database to ensure data is retained between sessions.
Before running the application, ensure you have:
- Python (version 3.x recommended)
- SQLite (Python’s
sqlite3
module is included with standard Python distributions)
-
Clone the Repository (or download the source code):
git clone https://github.com/mdriyadkhan585/todo-list-python.git cd todo-list-python
-
No Additional Packages Needed: The script uses built-in Python libraries.
Run the Python script with:
python todo_list.py
-
Add Task 🆕
- Enter the task description when prompted.
- The task will be added to the list.
-
View Tasks 📋
- Displays all current tasks with their respective IDs.
-
Delete Task 🗑️
- First, view the tasks to get the ID of the task you want to delete.
- Enter the task ID to remove it from the list.
-
Exit 🚪
- Exits the program.
todo_list.py
: Contains the main program logic including database operations and user interface.open_database()
: Opens the SQLite database.create_table(conn)
: Creates the tasks table if it does not exist.add_task(conn, task)
: Adds a new task to the database.view_tasks(conn)
: Retrieves and displays all tasks.delete_task(conn, task_id)
: Deletes a task based on its ID.main()
: Manages user interaction and menu options.
- "No tasks to show": Indicates that no tasks are present in the database. Add tasks to see them listed.
- "Invalid task number": Make sure to enter a valid task ID when deleting tasks. IDs are integers.
- "Failed to add task": Check for issues in task input or database connection.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to contribute by submitting issues or pull requests on the GitHub repository.