An open API service indexing awesome lists of open source software.

https://github.com/nivindulakshitha/console-lis

GCE AL Python console based Library Management App
https://github.com/nivindulakshitha/console-lis

csv python

Last synced: 4 months ago
JSON representation

GCE AL Python console based Library Management App

Awesome Lists containing this project

README

          

# ABC Engineering Library System

This is a Python-based library management system designed to handle the addition, borrowing, returning, and searching of books. It also keeps track of borrowed books and updates records in a CSV file.

---

## Features

1. **Add New Book**
Add a new book to the library collection.

2. **Borrow Book**
Borrow a book by providing its ID and a student ID.

3. **Return Book**
Return a borrowed book to the library.

4. **Search Books**
Search for books in the library by name.

5. **View Borrowed Books**
Display a list of all books currently borrowed.

6. **Exit**
Save the updated records to a CSV file and exit the program.

---

## Prerequisites

- Python 3.x
- A `books.csv` file to store book data. This file should contain data in the following format:
```
LB0001,book_name,author_name,True|False,borrower_id
```
Example:
```
LB0001,python programming,john doe,True,
LB0002,data structures,jane smith,False,ST00123
```

---

## How to Run

1. Save the code in a `.py` file (e.g., `main.py`).
2. Create a `books.csv` file in the same directory to store book records.
3. Open a terminal or command prompt.
4. Navigate to the directory containing `main.py`.
5. Run the script using the command:
```bash
python main.py
```

---

## Usage

### Main Menu
When the program starts, you'll see the following menu:
```
+=================================+
| ABC ENGINEERING LIBRARY |
+=================================+
| 1. Add New Book |
| 2. Borrow Book |
| 3. Return Book |
| 4. Search Books |
| 5. View Borrowed Books |
| 6. Exit |
+=================================+
```

Select an option by entering the corresponding number.

### Examples

#### Adding a New Book
1. Select **1** from the menu.
2. Enter the book's name and author when prompted.
3. The system will automatically generate a unique Book ID (e.g., `LB0001`).

#### Borrowing a Book
1. Select **2** from the menu.
2. Enter the Book ID of the book you want to borrow.
3. Provide the student ID of the borrower.
4. The book's availability will be updated to `False`, and the borrower's ID will be recorded.

#### Returning a Book
1. Select **3** from the menu.
2. Enter the Book ID of the book being returned.
3. The system will mark the book as available and remove the borrower ID.

#### Searching for Books
1. Select **4** from the menu.
2. Enter the book name or partial name to search.
3. The system will display matching books with their details.

#### Viewing Borrowed Books
1. Select **5** from the menu.
2. View a list of all books currently borrowed, along with their borrower's ID.

#### Exiting the Program
1. Select **6** from the menu.
2. The program will save all changes to the `books.csv` file and exit.

---

## Notes

- The system uses a `books.csv` file for persistent storage.
- Book IDs are automatically generated (e.g., `LB0001`).
- The program clears the console for a better user experience (may not work on some terminals).

---

## License

This project is licensed under the MIT License. Feel free to use and modify it as needed.