本文整理匯總了Python中book.Book.get_detail方法的典型用法代碼示例。如果您正苦於以下問題:Python Book.get_detail方法的具體用法?Python Book.get_detail怎麽用?Python Book.get_detail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類book.Book
的用法示例。
在下文中一共展示了Book.get_detail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Book
# 需要導入模塊: from book import Book [as 別名]
# 或者: from book.Book import get_detail [as 別名]
from book import Book
book1 = Book("physics","steve",1,323,True)
book2 = Book("c++","thomas",2,211,True)
book3 = Book("english","david",4,111,True)
book_detail1 = " ".join(book1.get_detail())
book_detail2 = " ".join(book2.get_detail())
book_detail3 = " ".join(book3.get_detail())
fh = open("book.txt","a+w")
fh.write("%s\n%s\n%s\n" %(book_detail1,book_detail2,book_detail3))
fh.close()
book_name = raw_input("enter book name: ")
fh = open("book.txt","a+")
flag = False
for line in fh.readlines():
if book_name in line:
flag = True
print line
if not flag:
book_author = raw_input("enter book author: ")
book_self =raw_input("enter book self: ")
book_serial = raw_input("enter book serial: ")
fh.write("%s,%s,%s,%s\n" %(book_name,book_author,book_self,book_serial))
perm = raw_input("do u want to place in self: ")
if perm == "yes" or "y":
print "you can borrow the book"
fh.close()