資源簡介
圖書管理系統
代碼片段和文件信息
#Book?management?system(圖書管理系統)
def?menu():
????print(“圖書管理系統(簡易版)“)
????print(“?????1.??新書存放“)
????print(“?????2.1?圖書查找(書名)“)
????print(“?????2.2?圖書查找(出版社)“)
????print(“?????3.??圖書查看“)
????print(“?????4.??退出系統“)
????choice?=?input(“\n請選擇要進行的功能編號:“)
????if?choice?==?‘1‘:
????????deposit_books()
????elif?choice?==?‘2.1‘:
????????searching_books_name()
????elif?choice?==?‘2.2‘:
????????searching_books_press()
????elif?choice?==?‘3‘:
????????display_books()
????elif?choice?==?‘4‘:
????????quit_system()
????else:
????????print(“\n\t操作有誤,即將重新進入主菜單...\n“)
????????menu()
def?deposit_books():????????????#新書存放
????
????print(“\n請輸入要存入的圖書及信息“)
????number?=?input(“?書號:“)
????name?=?input(“?書名:“)
????author?=?input(“?作者:“)
????press?=?input(“?出版社:“)
????pubdate?=?input(“?出版日期:“)
????InfoAboutABook?=?[numbernameauthorpresspubdate]
????books?=?open(‘library.txt‘‘a+‘)
????books.writelines(‘‘.join(InfoAboutABook)+‘\n‘)
????books.close()
????otherfunction1()
評論
共有 條評論