Python library management system project with simple and easy code. This python Library system implemented data storage in MySQL Database. This Database contains the different tables to maintain the data about the library. This Library Management project has different features
Features of Library Management System Project
- Add Books
- Add Member
- Update Book
- Update Member
- Issue Book
- Return Book
- Search Menu
- Report Menu
This LMS project store the data in database, this Project created a MySQL database with name "library"
This Database has 3 tables to store and retrieve the data about the LMS system.
To implement python Library Management project used below modules
MySql Connector : This module is used to connect mysql database to fetch/add data into database
DateTime : To set date and get current date and update the details on the tables
import mysql.connector from datetime import date
To Add a book we will use this below code
def add_book(): conn = mysql.connector.connect( host='localhost', database='library', user='root', password='') cursor = conn.cursor() title = raw_input('Enter Book Title :') author = raw_input('Enter Book Author : ') publisher = raw_input('Enter Book Publisher : ') pages = raw_input('Enter Book Pages : ') price = raw_input('Enter Book Price : ') edition = raw_input('Enter Book Edition : ') copies = int(raw_input('Enter copies : ')) sql = 'insert into book(title,author,price,pages,publisher,edition,status) values ( "' + \ title + '","' + author+'",'+price+','+pages+',"'+publisher+'","'+edition+'","available");' #sql2 = 'insert into transaction(dot,qty,type) values ("'+str(today)+'",'+qty+',"purchase");' #print(sql) for _ in range(0,copies): cursor.execute(sql) conn.close() print('\n\nNew Book added successfully') wait = raw_input('\n\n\n Press any key to continue....')
Like the above functionality we can add other features like Add Student, Update Book, Update Member, search books, Book reports etc...
Interested to use complete Python library management system code here