當前位置: 首頁>>代碼示例>>Python>>正文


Python Book.strip方法代碼示例

本文整理匯總了Python中book.Book.strip方法的典型用法代碼示例。如果您正苦於以下問題:Python Book.strip方法的具體用法?Python Book.strip怎麽用?Python Book.strip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在book.Book的用法示例。


在下文中一共展示了Book.strip方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: delete_book

# 需要導入模塊: from book import Book [as 別名]
# 或者: from book.Book import strip [as 別名]
def delete_book():
    to_do = input('''We're going to delete a book.  Do you have the barcode? [y/N]: ''')
    if to_do.strip() == "" or to_do.strip().lower() == "n":
        results = search()
        i = 1
        for item in results:
            print((i + ") " + item))  # not sure how this will come out.
        del_me = input("Which one is it? ")

        del_me = int(del_me)

        del_me = results[del_me - 1]
        del_me = del_me.split(",")
        del_me = Book(del_me[0])  # this is really fudged atm.  serious testing needed
        the_db = Bdb(dbLocation)
        the_db.delete(del_me)
        print("Deleted.")

    elif to_do.strip().lower() == "y":
        del_me = input("Ok, enter it now: ")
        if del_me.strip() == "":
            print("Invalid input.")
        else:
            del_me = int(del_me)
            del_me = Book(del_me)
            the_db = Bdb(dbLocation)
            the_db.delete(del_me)
            print("Deleted.")
開發者ID:bjschafer,項目名稱:pyberry,代碼行數:30,代碼來源:PyBerry.py


注:本文中的book.Book.strip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。