本文整理汇总了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()