精华内容
下载资源
问答
  • 图书管理系统python-Django.zip
  • 本文实例为大家分享了python图书管理系统的具体代码,供大家参考,具体内容如下"""图书管理系统"""import random# books={书名:剩余数量, 书名:剩余数量}import timebooks = {"...

    本文实例为大家分享了python图书管理系统的具体代码,供大家参考,具体内容如下

    """

    图书管理系统

    """

    import random

    # books={书名:剩余数量, 书名:剩余数量}

    import time

    books = {"防脱发指南": 5, "颈椎康复指南": 3, "从删库到跑路": 0}

    # students_books=[name,{书}]

    students_books = {"赵路遥": []}

    class book(object):

    """先传一个书名,以后可根据需要传 开始借书时间,书的详细信息,以及之前借书的人等等"""

    def __init__(self, bookname):

    super(book, self).__init__()

    self.bookname = bookname

    def getBookName(self):

    return self.bookname

    if __name__ == "__main__":

    print("*" * 50)

    print("欢迎来到遥遥哥的图书馆".center(50))

    print("*" * 50)

    while True:

    choices = input(""" 请选择你所需要的功能

    1.查询书籍 2.借书 3.还书 4.显示所有书籍 5.查询用户所借的书 6.退出系统:""")

    if choices == "1":

    # 查询书籍

    print("--------查询书籍---------")

    search_book = input("请输入要查询的书籍名称:")

    # 遍历books

    for book in books.keys():

    if search_book in book:

    print("正在查找,请稍等")

    time.sleep(1)

    if books[search_book] > 0:

    print("你说查找的书,目前还有{}本".format(books[search_book]))

    break

    else:

    print("你所查找的书,已经借完,请过段时间之后再来")

    break

    else:

    print("对不起你所输入的书不存在,可联系管理员补充")

    elif choices == "2":

    # 借书

    print("欢迎来到借书页面".center(50))

    flag = True

    while flag:

    user_name = input("请输入用户名")

    borrow_book = input("请输入你所借的书名")

    for book in books.keys():

    if borrow_book == book:

    if user_name in students_books.keys():

    if books[borrow_book] > 0:

    if borrow_book not in students_books[user_name]:

    print(r"你已经借书<<{}>>".format(borrow_book))

    students_books[user_name].append(borrow_book)

    books[borrow_book] -= 1

    print(r"现在<<{}>>,剩余{}本".format(borrow_book, books[borrow_book]))

    flag = False

    break

    else:

    print("对不起,你已经借了一本")

    flag = False

    break

    else:

    print("对不起你所借的书剩余{}本,请下次再来".format(books[borrow_book]))

    flag = False

    break

    else:

    students_books[user_name] = []

    students_books[user_name].append(borrow_book)

    books[borrow_book] -= 1

    print(r"新用户( {} )已经借书<< {} >>,目前此书剩余{}本".format(user_name, borrow_book, books[borrow_book]))

    flag = False

    break

    else:

    print("对不起你所查找的书,不存在,请联系管理员更新")

    elif choices == "3":

    flag=True

    while flag:

    user_name = input("请输入你的名字")

    repay_book = input("情输入你所要还的书")

    for name in students_books.keys():

    #先去判断有没有这个人

    if name==user_name:

    #判断有没有这本书在不在该用户

    if repay_book in students_books[name]:

    #判断此本书书否在图书馆库里面

    if repay_book in books.keys():

    books[repay_book]+=1

    students_books[name].remove(repay_book)

    print("正在还书,请稍等")

    time.sleep(1)

    print("你已经还书了,这本书数量为{}".format(books[repay_book]))

    flag=False

    break

    else:

    print("此本书不在图书馆库里面,请重新输入")

    break

    else:

    print("你所输入的书,并在你的借书目录里面,请重新输入")

    break

    else:

    print("对不起你所输入的人不存在,请重新输入")

    elif choices == "4":

    # 显示所有书籍

    print("图书馆目前所藏书籍如下:")

    for bookkey, bookvalue in list(books.items()):

    print(r"<<{}>>目前还有 {} 本".format(bookkey, bookvalue))

    time.sleep(0.5)

    elif choices=="5":

    username=input(" 请输入你要查询的用户名")

    for stu in students_books.keys():

    if username== stu:

    print("{}所借的书有{}".format(user_name,students_books[username]))

    else:

    print("你查找的用户不在")

    elif choices == "6":

    choice = ("确定是否退出,确认请输入yes,否则请输入no")

    if choice == "yes":

    print("感谢你的使用,再见")

    break

    else:

    print("输入错误请重新输入....")

    更多学习资料请关注专题《管理系统开发》。

    以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

    展开全文
  • 本文实例为大家分享了python实现图书管理系统的具体代码,供大家参考,具体内容如下import mysql.connectorimport sys, osimport timeimport datetimefrom tkinter import *from tkinter.messagebox import *class ...

    本文实例为大家分享了python实现图书管理系统的具体代码,供大家参考,具体内容如下

    import mysql.connector

    import sys, os

    import time

    import datetime

    from tkinter import *

    from tkinter.messagebox import *

    class Libop:

    user = "root"

    pwd = ""

    host = "localhost"

    db = "library"

    data_file = "mysql-test.dat"

    def __init__(self):

    print("init")

    try:

    self.library=mysql.connector.connect(user=Libop.user,password=Libop.pwd,host=Libop.host,database=Libop.db)

    self.cursor=self.library.cursor()

    print("Connect successfully")

    except mysql.connector.Error as err:

    print("WTF! initial wrong")

    print("Error: {}".format(err.msg))

    sys.exit()

    def select(self,str):

    try:

    self.cursor.execute(str)

    return self.cursor.fetchall()

    except mysql.connector.Error as err:

    print("WTF! select wrong")

    print("Error:{}".format(err.msg))

    print(str)

    showinfo("ERROR","Please input the parameter correctly")

    def update(self,str):

    try:

    self.cursor.execute(str)

    self.library.commit()

    return 1

    except mysql.connector.Error as err:

    print("WTF! update wrong")

    print("Error:{}".format(err.msg))

    return 0

    def delete(self,str):

    try:

    self.cursor.execute(str)

    self.library.commit()

    except mysql.connector.Error as err:

    print("WTF! delete wrong")

    print("Error:{}".format(err.msg))

    def insert(self,str):

    try:

    self.cursor.execute(str)

    self.library.commit()

    return 1

    except mysql.connector.Error as err:

    print("WTF! insert wrong")

    print("Error:{}".format(err.msg))

    return 0

    LIB = Libop()

    root=Tk()

    root.wm_title("Library System")

    str1=str2=""

    book_type=name=year=publisher=writer=price1=price2=order=""

    cardid=""

    def call_rent(en1,en2,brok):

    st1=en1.get()

    st2=en2.get()

    rent(st1,st2,brok)

    def call_return(en1,en2):

    st1=en1.get()

    st2=en2.get()

    back(st1,st2)

    def login():

    str1=ide.get()

    str2=pwde.get()

    curs=LIB.select("select manage_id,pswd from managers where manage_id="{}" and pswd="{}"".format(str1,str2))

    if ((str1,str2) in curs):

    showinfo("message","login success")

    label_book_id=Label(root,text="BookID:").grid(row=0,column=4,sticky=W)

    label_card_id=Label(root,text="CardID:").grid(row=1,column=4,sticky=W)

    entry_book_id=Entry(root)

    entry_book_id.grid(row=0,column=5,sticky=W)

    entry_card_id=Entry(root)

    entry_card_id.grid(row=1,column=5,sticky=W)

    entry_cardid=Entry(root)

    entry_cardid.grid(row=5,column=0,sticky=W)

    #buttons

    button_insert=Button(root,text="insert book",command=inbook)

    button_insert.grid(row=0,column=2,sticky=W)

    button_return=Button(root,text="rent book")

    button_return.bind("",lambda z:call_rent(entry_book_id,entry_card_id,str1))

    button_return.grid(row=0,column=3,sticky=W)

    button_rent=Button(root,text="return book")

    button_rent.bind("",lambda l:call_return(entry_book_id,entry_card_id))

    button_rent.grid(row=1,column=2,sticky=W)

    button_delete=Button(root,text="delete card")

    button_delete.bind("",lambda j:deletecard(entry_cardid))

    button_delete.grid(row=5,column=2,sticky=W)

    button_add=Button(root,text="add card",command=addwindow)

    button_add.grid(row=5,column=3,sticky=W)

    button_display=Button(root,text="display books")

    button_display.bind("",lambda y:display_rent(entry_cardid))

    button_display.grid(row=5,column=1,sticky=W)

    else:

    showinfo(title="login failure",message="WRONG ID OR PASSWORD!")

    #add a card

    def addwindow():

    top=Toplevel(root)

    label_card_id=Label(top,text="card id:").grid(row=0,column=0,sticky=W)

    label_name=Label(top,text="Name:").grid(row=1,column=0,sticky=W)

    label_unit=Label(top,text="Units:").grid(row=2,column=0,sticky=W)

    label_type=Label(top,text="type:").grid(row=3,column=0,sticky=W)

    entry_card_id=Entry(top)

    entry_card_id.grid(row=0,column=1,sticky=W)

    entry_name=Entry(top)

    entry_name.grid(row=1,column=1,sticky=W)

    entry_unit=Entry(top)

    entry_unit.grid(row=2,column=1,sticky=W)

    entry_type=Entry(top)

    entry_type.grid(row=3,column=1,sticky=W)

    button_constructe=Button(top,text="Add")

    button_constructe.bind("",lambda q:addcard(entry_card_id,entry_name,entry_unit,entry_type))

    button_constructe.grid(row=4)

    def addcard(en1,en2,en3,en4):

    cardid=en1.get()

    name=en2.get()

    unit=en3.get()

    c_type=en4.get()

    select="select card_id from lib_card where card_id="{}"".format(cardid)

    if (c_type not in ("T","S","O")):

    showinfo("error","NO SUCH TYPE")

    return 0

    line=LIB.select(select)

    if (len(line)!=0):

    showinfo("addition failure","Already have this ID!")

    else:

    insert="insert into lib_card values("{}","{}","{}","{}")".format(cardid,name,unit,c_type)

    LIB.insert(insert)

    showinfo("ok","addition success")

    return 1

    #insert book

    def inbook():

    insert_book=Toplevel(root)

    insert_book.title("insert book")

    text_insert=Text(insert_book)

    text_insert.pack()

    button_confirm=Button(insert_book,text="confirm")

    button_confirm.bind("",lambda x:booksin(text_insert))

    button_confirm.pack()

    def booksin(text_insert):

    string=text_insert.get("0.0",END)

    string=string.split(" ")

    print(string)

    for line in string:

    if line=="":

    break

    lines=line.split(",")

    bookid=lines[0][1:]

    t=lines[1]

    name=lines[2]

    publisher=lines[3]

    year=lines[4]

    writer=lines[5]

    price=lines[6]

    total=lines[7]

    stock=lines[8][:-1]

    if (int(stock)>int(total) or int(price)<0):

    showinfo("insert error!","stock wrong or price is below 0!")

    continue

    #print("insert into book values("{}","{}","{}","{}",{},"{}",{},{},{})".format(bookid,t,name,publisher,year,writer,price,total,stock))

    t=LIB.insert("insert into book values("{}","{}","{}","{}",{},"{}",{},{},{})".format(bookid,t,name,publisher,year,writer,price,total,stock))

    if (t==0):

    showinfo("error","book {} has been inserted".format(bookid))

    showinfo("success","insert has been done")

    #original window

    label_type=Label(root,text="TYPE").grid(row=3,sticky=W,column=0)

    label_name=Label(root,text="NAME").grid(row=3,sticky=W,column=1)

    label_year=Label(root,text="YEAR(XXXX-XXXX)").grid(row=3,sticky=W,column=2)

    label_publisher=Label(root,text="PUBLISHER").grid(row=3,sticky=W,column=3)

    label_writer=Label(root,text="WRITER").grid(row=3,sticky=W,column=4)

    label_lowprice=Label(root,text="lowestprice").grid(row=3,sticky=W,column=5)

    label_highprice=Label(root,text="highestprice").grid(row=3,sticky=W,column=6)

    label_order=Label(root,text="order by").grid(row=0,sticky=W,column=6)

    entry_type=Entry(root)

    entry_type.grid(row=4,column=0,sticky=W)

    entry_name=Entry(root)

    entry_name.grid(row=4,column=1,sticky=W)

    entry_year=Entry(root)

    entry_year.grid(row=4,column=2,sticky=W)

    entry_publisher=Entry(root)

    entry_publisher.grid(row=4,column=3,sticky=W)

    entry_writer=Entry(root)

    entry_writer.grid(row=4,column=4,sticky=W)

    entry_price1=Entry(root)

    entry_price1.grid(row=4,column=5,sticky=W)

    entry_price2=Entry(root)

    entry_price2.grid(row=4,column=6,sticky=W)

    #order the result

    order_index=0

    Lb_order=Listbox(root,selectmode=SINGLE,height=6)

    order="name","book_type","T","writer","price","publisher"

    Lb_order.insert(0,order[0])

    Lb_order.insert(1,"type")

    Lb_order.insert(2,"year")

    Lb_order.insert(3,order[3])

    Lb_order.insert(4,order[4])

    Lb_order.insert(5,order[5])

    Lb_order.grid(row=0,column=7,sticky=W)

    Lb_order.selection_set(0)

    def booksearch():

    select="select BookID,book_type,name,publisher,T,writer,price,total,stock from book"

    order_index=Lb_order.curselection()

    if (len(order_index)!=0):

    order_index=order_index[0]

    else:

    order_index=0;

    orders=order[order_index]

    name=entry_name.get()

    book_type=entry_type.get()

    publisher=entry_publisher.get()

    year=entry_year.get()

    writer=entry_writer.get()

    price1=entry_price1.get()

    price2=entry_price2.get()

    year1=year[0:4]

    year2=year[5:9]

    count=0

    if name!="":

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" name="{}"".format(name)

    if book_type!="":

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" book_type="{}"".format(book_type)

    if publisher!="":

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" publisher="{}"".format(publisher)

    if year1!="":

    if year2=="":

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" t={}".format(year1)

    else:

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" T between {} and {}".format(year1,year2)

    if writer!="":

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" writer="{}"".format(writer)

    if price1!="":

    if price2!="":

    if count!=0:

    select+=" and"

    else:select+=" where"

    count+=1

    select+=" price between {} and {}".format(price1,price2)

    else:

    if count!=0:

    selece+="and"

    else:select+=" where"

    count+=1

    select+=" price={}".format(price1)

    if orders=="":

    select+=" order by name"

    else:

    select+=" order by {}".format(orders)

    print(select)

    curs=LIB.select(select)

    searchresult=Toplevel(root)

    searchresult.title("result")

    text=Text(searchresult)

    text.insert(INSERT,"BookID type name publish year writer price total stock ")

    for (BookIDs,book_types,names,publishers,years,writers,prices,totals,stocks) in curs:

    text.insert(INSERT,"{} {} {} {} {} {} {} {} {} ".format(BookIDs,book_types,names,publishers,years,writers,prices,totals,stocks))

    text.pack()

    def display_rent(en_cardid):

    cardid=en_cardid.get()

    select="select card_id from lib_card where card_id="{}"".format(cardid)

    curs=LIB.select(select)

    order_index=Lb_order.curselection()

    if len(order_index)!=0 :

    order_index=order_index[0]

    else:

    order_index=0;

    orders=order[order_index]

    if ((cardid,) in curs):

    select="select card_id,name,unit,c_type from lib_card where card_id="{}"".format(cardid)

    curs=LIB.select(select)

    top=Toplevel(root)

    text=Text(top)

    for (card_id,name,unit,c_type) in curs:

    text.insert(INSERT,"card_id:{} ".format(card_id))

    text.insert(INSERT,"name:{} ".format(name))

    text.insert(INSERT,"unit:{} ".format(unit))

    text.insert(INSERT,"c_type:{} ".format(c_type))

    select="select BookID,book_type,name,publisher,t,writer,price,total,stock from book natural join record where card_id="{}" and still=1 order by {}".format(cardid,orders)

    curs=LIB.select(select)

    text.insert(INSERT,"BookID type name publish year writer price total stock ")

    for (BookID,book_type,name,publisher,t,writer,price,total,stock) in curs:

    text.insert(INSERT,"{} {} {} {} {} {} {} {} {} ".format(BookID,book_type,name,publisher,t,writer,price,total,stock))

    text.pack()

    else:

    showinfo("Error","NO SUCH CARD")

    def checkcard(cardid):

    select="select card_id from lib_card where card_id="{}"".format(cardid)

    curs=LIB.select(select)

    if (cardid,) in curs:

    return 1

    else:

    return 0

    def rent(BookID,cardid,brokerage):

    if not (checkcard(cardid)):

    showinfo("error","no such card")

    return 0

    select="select stock from book where BookID="{}"".format(BookID)

    stocks=LIB.select(select)

    #stocks=curs.fetchall()

    stock=stocks[0]

    if (stock>(0,)):

    update="update book set stock=stock-1 where BookID="{}"".format(BookID)

    flag=LIB.update(update)

    if flag:

    insert="insert into record values("","{}","{}",CURDATE(),DATE_ADD(CURDATE(),INTERVAL 1 MONTH),"{}",1)".format(cardid,BookID,brokerage)

    LIB.insert(insert)

    showinfo("rent success","OK")

    else:

    showinfo("rent failure","stock wrong")

    else:

    select="select return_time from record where BookID="{}" and return_time>=all(select return_time from record where BookID="{}")".format(BookID,BookID)

    date=LIB.select(select)

    #date=curs.fetchall()

    date=str (date)

    showinfo("Out of stock","There are no more such book,The recent returning will be at:{}-{}-{}".format(date[16:20],date[22:23],date[26:27]))

    return 1

    def back(BookID,cardid):

    if not(checkcard(cardid)): return 0

    select="select BookID from record where BookID="{}" and card_id="{}" and still=1".format(BookID,cardid)

    curs=LIB.select(select)

    if (BookID,) in curs:

    select="select record_id from record where BookID="{}" and card_id="{}" and still=1 order by rent_time".format(BookID,cardid)

    cur=LIB.select(select)

    #cur=curss.fetchall()

    for record in cur:

    recordid=str (record)

    recordid=recordid[1:]

    recordid=recordid[:-2]

    update="update record set still=0 where record_id="{}"".format(recordid)

    LIB.update(update)

    update="update book set stock=stock+1 where BookID="{}"".format(BookID)

    LIB.update(update)

    break

    showinfo("message","Return Success!")

    return 1

    else:

    showinfo("error","You can"t return the book!")

    return 1

    def deletecard(card):

    cardid=card.get()

    if not (checkcard(cardid)):

    showinfo("error","NO SUCH CARD")

    return 0

    select="select record_id from record where card_id="{}" and still=1".format(cardid)

    curs=LIB.select(select)

    for record_id in curs:

    showinfo("error","Some books this card rented haven"t been returned")

    return 0

    delete="delete from lib_card where card_id="{}"".format(cardid)

    LIB.delete(delete)

    showinfo("ok","success")

    return 1

    label_id=Label(root,text="ID: ")

    label_id.grid(row=0,sticky=W)

    ide=Entry(root)

    ide.grid(row=0,column=1,sticky=E)

    label_psw=Label(root,text="PassWord: ").grid(row=1,sticky=W)

    pwde=Entry(root,show="*")

    pwde.grid(row=1,column=1,sticky=E)

    log_button=Button(root,text="Login",command=login)

    log_button.grid(row=2,column=1)

    button_search=Button(root,text="Search Book",command=booksearch)

    button_search.grid(row=4,column=7,sticky=W)

    print("all done")

    root.mainloop()

    更多学习资料请关注专题《管理系统开发》。

    以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

    展开全文
  • 代码注释详细,人机实时交互。运行代码前请安装前几行代码中所提到的wx库、re库等等。代码中涉及到的路径,文本文件等等,您替换成自己的路径和文本文件即可。
  • ")defmain():whileTrue:print(" **********************")print("*欢迎来到图书管理系统*")print("********************** ")print("*********************************")print("****** 登录-------1 **********")...

    importsys

    books=[["红楼梦","曹雪芹",50],["三国义","罗贯中",55],["西游记","吴承恩",60],["水浒传","施耐庵",65]]

    users=[["Tom","123"],["Mike","321"]]

    flag=Falsedeflogin():print("请输入用户名:",end="")

    username=input()print("请输入用户密码:",end="")

    password=input()if [username,password] inusers:print("登录成功!")

    flag=True

    fun()else:print(" 用户名不存在或密码错误! 请重新登录!")defregister():

    username=input("请输入用户名:")

    password=input("请输入用户密码:")

    users.append([username,password])print("注册成功!")defmain():whileTrue:print(" **********************")print("*欢迎来到图书管理系统*")print("********************** ")print("*********************************")print("****** 登录-------1 **********")print("****** 注册-------2 **********")print("****** 退出-------0 **********")print("********************************* ")

    v=int(input("请输入对应的数字:"))if v==2:

    register()elif v==1:

    login()elif v==0:

    sys.exit(0)deffun():whileTrue:print(" ***************************************")print("******** 增加书籍--------1 **********")print("******** 删除书籍--------2 **********")print("******** 查找书籍--------3 **********")print("******** 修改书籍--------4 **********")print("******** 查看所有书籍----5 **********")print("******** 返回主界面------6 **********")print("******** 退出------------0 **********")print("*************************************** ")

    v=int(input("请输入对应的数字: "))if v==1:

    bookname=input("请输入书名:")

    author=input("请输入作者:")

    price=int(input("请输入价格:"))

    books.append([bookname,author,price])print(" 添加书籍成功!")elif v==2:

    bookname=input("请输入书名:")

    author=input("请输入作者:")

    price=int(input("请输入价格:"))if [bookname,author,price] inbooks:

    books.remove([bookname,author,price])print(" 删除书籍成功!")else:print(" 该书籍不存在!自动返回...")elif v==3:

    bookname=input("请输入书名:")print()

    j=0for i inbooks:if i[0]==bookname:

    j=1

    print("书名:",i[0],"作者:",i[1],"价格:",i[2])if j==0:print("该书籍不存在!自动返回...")print(" 查找结束! ")elif v==4:

    bookname=input("请输入书名:")

    author=input("请输入作者:")

    price=int(input("请输入价格:"))if [bookname,author,price] inbooks:

    books.remove([bookname,author,price])

    bookname=input("请输入修改后的书名:")

    author=input("请输入修改后的作者:")

    price=int(input("请输入修改后的价格:"))

    books.append([bookname,author,price])print(" 修改书籍成功!")else:print(" 该书籍不存在!自动返回...")elif v==5:print(" 书名 ","作者 ","价格 ")for i inbooks:print(i[0]," ",i[1]," ",i[2])print()elif v==0:

    sys.exit(0)elif v==6:

    main()

    main()

    展开全文
  • book_list=[] #图书馆所有书 unborrowed_book=[] #可借阅的书 borrowed_book=[] #已经借出去的书 def add(): #添加书 global book_list global unborrowed_book book_name=raw_input(u"请输入要添加的书名.....

    #coding=utf-8

    book_list=[]  #图书馆所有书

    unborrowed_book=[]  #可借阅的书

    borrowed_book=[]  #已经借出去的书

     

    def add():  #添加书

        global book_list

        global unborrowed_book

        book_name=raw_input(u"请输入要添加的书名:".encode("gbk"))

        book_list.append(book_name)

        unborrowed_book.append(book_name)

        print u"添加书成功"

     

    def borrow_book():  #借书

        global unborrowed_book

        global borrowed_book

        while 1:

            book_name=raw_input(u"请输入要借的书名:".encode("gbk"))

            if book_name in unborrowed_book:

                unborrowed_book.remove(book_name)        

                borrowed_book.append(book_name)

                print u"借书成功"

                break

            else:

                print u"抱歉,您要借的书不存在!"

                continue_back=raw_input(u"继续借书请输入:c 返回主菜单请输入:b ".encode("gbk"))

                if continue_back.lower()=="c":

                    continue

                elif continue_back.lower()=="b":

                    break

                else:

                    print u"输入数据无效"            

     

    def return_book():  #还书

        global borrowed_book

        global unborrowed_book

        while 1:

            book_name=raw_input(u"请输入要还的书名:".encode("gbk"))

            if book_name in borrowed_book:

                borrowed_book.remove(book_name)

                unborrowed_book.append(book_name)

                print u"还书成功"

                break

            else:

                print u"您输入的书名不是此图书馆的"

                continue_back=raw_input(u"继续还书请输入:c 返回主菜单请输入:b ".encode("gbk"))

                if continue_back.lower()=="c":

                    continue

                elif continue_back.lower()=="b":

                    break

                else:

                    print u"输入数据无效"    

     

    menu_info='''

    添加书--请输入:1

    借书--请输入:2

    查看可借阅的书--请输入:3

    查看借出去的书--请输入:4

    还书--请输入:5

    查看所有书--请输入:6

    退出--请输入:q

    '''

    import sys

    print menu_info.decode("utf-8")

     

    while True:    

        command=raw_input(u"请输入您要做的操作选项:".encode("gbk"))

        if command=="1":

            add()

        elif command=="2":

            borrow_book()

        elif command=="3":

            if unborrowed_book==[]:

                print u"抱歉,没有可以借的书了!"

            else:

                print u"可借阅的书:",unborrowed_book    

        elif command=="4":

            if borrowed_book==[]:

                print u"没有借出去的书!"

            else:

                print u"借出去的书:",borrowed_book

        elif command=="5":

            return_book()

        elif command=="6":

            if book_list==[]:

                print u"图书馆还没有书,赶快去添加吧!"

            else:

                print u"图书馆所有的书:",book_list

        elif command=="q":

            sys.exit()

        else:

            print u"输入数据无效!"

     

    转载于:https://www.cnblogs.com/reyinever/p/8053597.html

    展开全文
  • python编写图书管理系统python编写图书管理系统python编写图书管理系统
  • 内容简介:这篇文章主要为大家详细介绍了python实现图书管理系统,具有一定的参考价值,感兴趣的小伙伴们可以参考一下本文实例为大家分享了 python 实现图书管理系统的具体代码,供大家参考,具体内容如下import ...
  • python实实现现简简单单图图书书管管理理系系统统 这篇文章主要为大家详细介绍了python实现简单图书管理系统文中示例代码介绍的非常详细具有一定的参考 价值感兴趣的小伙 们可以参考一下 用python实现一个简单的图书...
  • 本文实例为大家分享了python图书管理系统的具体代码,供大家参考,具体内容如下"""图书管理系统"""import random# books={书名:剩余数量, 书名:剩余数量}import timebooks = {"...
  • python图书管理系统

    2020-09-20 17:38:45
    主要为大家详细介绍了python图书管理系统的实现代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
  • Python图书管理系统

    2018-07-04 22:53:05
    一个基于Python图书管理系统, 主要实现书籍的增删改查。
  • ')defmain():whileTrue:print(' **********************')print('*欢迎来到图书管理系统*')print('********************** ')print('*********************************')print('****** 登录-------1 **********')...
  • 首先展示一下图书管理系统的首页:这是图书管理系统的发布图书页面:最后是图书管理系统的图书详情页已经图书进行删除的管理页。该图书管理系统为练习阶段所做,能够实现图书详情的查询、图书的添加、图书的删除功能...
  • 基于python+mysql的图书管理系统,有数据库文件,有图书的增删改查 需wxpython,有简单界面,适合刚入门的同学
  • 图书管理系统"""import random# books={书名:剩余数量, 书名:剩余数量}import timebooks = {"防脱发指南": 5, "颈椎康复指南": 3, "从删库到跑路": 0}# students_...
  • 主要为大家详细介绍了python实现图书管理系统,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
  • python实现一个简单的图书管理系统 ,供大家参考,具体内容如下 1、工具:PyCharm3.6 社区版 我创建了一个工程叫fairy,把解释器换成Pytnon3.6 创建一个pytnon file:图书管理系统.py 2、实现简单界面如下: ...
  • 图书管理系统 Python项目-库管理系统该项目主要关注于面向对象编程(OOP)。 我创建了一个图书馆,学生/任何人可以借书,归还书籍,将书捐赠给图书馆并跟踪学生/任何人拿走的所有书。
  • 图书管理系统
  • 1.使用python django开发的图书管理系统 2.系统分为管理员的普通用户登录,普通用户拥有注册功能 3.管理员登录能够查看出版社,能够增删改查图书列表 4.普通用户登录能够看看图书,搜索图书 5.注销退出功能
  • Python实现图书管理系统

    万次阅读 2019-06-26 09:44:05
    Python实现图书管理系统 功能描述 1.界面分为两个部分,分别是(1)登录注册界面(2)图书管理系统界面 2.用户名和密码提前存储在列表中,输入用户名或密码错误提示重新输入,未注册的需要先注册帐号密码,再...
  • python 图书管理系统

    2020-02-18 14:59:53
    python 图书管理系统 # 示例代码 books=[ {"bookname":"红楼梦","numbers":2}, {"bookname":"西游记","numbers":3}, {"bookname":"三国演义","numbers":2}, {"bookname":"水浒传","numbers":2}, {"bookname":...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 690
精华内容 276
关键字:

图书管理系统python

python 订阅