0% found this document useful (0 votes)
12 views

project computer

Uploaded by

renu.mishra340
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

project computer

Uploaded by

renu.mishra340
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

SETH M.R.

JAIPURIA SCHOOL BANSAL


CAMPUS
SITAPUR ROAD, LUCKNOW
Session: 2024-2025

Library management system csv

Submitted by - Pawani Mishra


Board Roll Number –
Class – XII Section – A
Index

Serial Content Page


No. No.
1 Certificate 3
2 Acknowledgement 4
3 Introduction 5
4 Project Summary 6-7
5 Source Code 8-15
6 Screenshots 16-19
7 Bibliography 20
CERTIFICATE
This is to certify that the Project titled
Library Management System CSV is
carried out by Pawani Mishra under the
supervision of Ms. Rekha Singh Rawat
PGT Computer Science for partial
fulfilment of All India Senior School
Certificate Examination (AISSCE) class XII
practical exam 2025

Ms. Rekha Singh Rawat Ms. Gunjan Sahani

Computer Teacher Principal

Dept. of Computer Seth M.R. Jaipuria


School
JSBC Bansal Campus

Lucknow Lucknow

ACKNOWLEDGEMENT

I would like to express my sincere gratitude to Ms. Gunjan


Sahani, Principal, Seth M.R. Jaipuria School Bansal
Campus, Lucknow for her support in the preparation of
this project. My deep acknowledgements are also to my
Computer Science teacher Ms. Rekha Singh Rawat for
giving me an interesting topic for the project and guiding
me in the right direction. With the help of the above
mentioned people, I have got style to present my project
in a beautiful and understanding way.
“I have tried my level best to make my project in an
understanding way and language with the help of my
teachers and friends and I hope that this work will be
appreciated by one and all.”
Pawani Mishra
Class XII (A)

INTRODUCTION
 This project strives to imitate the library
management system in a simplified way
 It uses Python language CSV to store data about the
books in the library
 This program comprises many in built functions
which will help in various tasks i.e. adding new books
, deleting books , listing books, modifying existing
books , or to Search a Book Record
 If user enters any no. as per the choice that function
would be executed
Project Summary

Front End Details

Python Function Name Purpose

Menu() It is the function that takes


choice for further execution
listBooks() It will list all the books present
in the library
searchBook() This will search any book from
the library if not present it will
terminate
deleteBook() It will delete the existing
records as per the BookId
updateBook() This will modify the existing
book records
newBook() This will help adding new book
to the library
Module used : csv,os

Back End Details

File names Purpose


Library.csv The main file in which
details will be stored
Temporary.csv It is the file that stores the
modified data
Source code
import os
import csv
def newBook():
print("Add a New Book Record")
print("========================")
f=open('Library.csv','a',newline='\r\n')
s=csv.writer(f)
BookId=int(input('Enter Book Id='))
BookName=input('Enter Book Name=')
Author=input('Enter Author=')
Cost=float(input('Enter Cost='))
rec=[BookId,BookName,Author,Cost]
s.writerow(rec)
f.close()
print("Record Saved...")
input("Press any key to continue..")

def updateBook():
print("Modify a Book Record")
print("=======================")
f=open('Library.csv','r',newline='\r\n')
f1=open('temporary.csv','w',newline='\r\n')
f1=open('temporary.csv','a',newline='\r\n')
r=input('Enter Book Id of Book you want to
modify=')
s=csv.reader(f)
s1=csv.writer(f1)

for rec in s:
if rec[0]==r:
print("BookId=",rec[0])
print("BookName=",rec[1])
print("Author=",rec[2])
print("Cost=",rec[3])
choice=input("Do you want to
modify..?(y/n)=")
if choice=='y' or choice=='Y':
BookId=int(input('Enter New BookId='))
BookName=input('Enter new Book
Name=')
Author=input('Enter Author=')
Cost=float(input('Enter Cost='))
rec=[BookId,BookName,Author,Cost]
s1.writerow(rec)
print("Record Modified...")
else:
s1.writerow(rec)
else:
s1.writerow(rec)

f.close()
f1.close()
os.remove("Library.csv")
os.rename("temporary.csv","Library.csv")

input("Press any key to continue...")

def deleteBook():
f=open('Library.csv','r',newline='\r\n')
f1=open('temporary.csv','w',newline='\r\n')
f1=open('temporary.csv','a',newline='\r\n')
r=input('Enter BookId of Book you want to
delete=')
s=csv.reader(f)
s1=csv.writer(f1)

for rec in s:
if rec[0]==r:
print("BookId=",rec[0])
print("Book Name=",rec[1])
print("Author=",rec[2])
print("Cost=",rec[3])
choice=input("Do you want to delete this
record(y/n)=")
if choice=='y' or choice=='Y':
pass
print("Record Deleted...")
else:
s1.writerow(rec)
else:
s1.writerow(rec)

f.close()
f1.close()
os.remove("Library.csv")
os.rename("temporary.csv","Library.csv")

input("Press any key to continue...")

def searchBook():
print("Search a Record")
print("===================")
f=open('Library.csv','r',newline='\r\n')
r=input('Enter BookId you want to search=')
s=csv.reader(f)

for rec in s:
if rec[0]==r:
print("BookId=",rec[0])
print("Book Name=",rec[1])
print("Author=",rec[2])
print("Cost=",rec[3])

f.close()
input("Press any key to continue..")
def listBooks():
print("List of All Books")
print("===================")
f=open('Library.csv','r',newline='\r\n')
s=csv.reader(f)
for rec in s:
print(rec[0],end="\t\t")
print(rec[1],end="\t\t")
print(rec[2],end="\t\t")
print(rec[3])

f.close()
input("Press any key to continue...")

def menu():
choice=0
while choice!=6:
print("\n")

print("===========================
=========")
print("Softare for Library Data Management")

print("===========================
=========")
print("\n==========")
print("Main Menu")
print("==========")
print("1. Add a new Book Record")
print("2. Modify Existing Book Record")
print("3. Delete Existing Book Record")
print("4. Search a Book Record")
print("5. List of all Books")
print("6. Quit")
choice=int(input('Enter your choice'))
if choice==1:
newBook()
elif choice==2:
updateBook()
elif choice==3:
deleteBook()
elif choice==4:
searchBook()
elif choice==5:
listBooks()
elif choice==6:
print("Good Bye")
break
menu()

OUTPUT SCREENSHOTS
Main menu
For adding a new record
For modifying existing record
For listing all the books

For deleting existing book


For searching a book

Quit
BIBLOGRAPHY

● Computer Science With Python Textbook For


Class XII

● www.python.org

● www.ncert.nic.in

You might also like