本文整理匯總了Python中Search.changed_time_key方法的典型用法代碼示例。如果您正苦於以下問題:Python Search.changed_time_key方法的具體用法?Python Search.changed_time_key怎麽用?Python Search.changed_time_key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Search
的用法示例。
在下文中一共展示了Search.changed_time_key方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: datetimesortkey_chapter_number
# 需要導入模塊: import Search [as 別名]
# 或者: from Search import changed_time_key [as 別名]
def datetimesortkey_chapter_number(x):
"""concatenates chapter number with the time.
pads the chapter number if necessary."""
#
# example keys:
# _________________________081021_165843
# 01.English00000000000000_081022_154011
# 01.Hindi0000000000000000_081022_154008
#
if x.has_key("chapter_number"):
chapter = x["chapter_number"]
chapter = chapter.strip()
chapter = chapter[:maxChapterDigits]
# if chapter.isdigit():
# chapter = int(chapter)
# chapter = ('%(#)0' + str(maxChapterDigits) + 'd') % {'#': chapter}
# else:
# chapter = chapter.ljust(maxChapterDigits, '0')
chapter = chapter.ljust(maxChapterDigits, "0")
else:
chapter = "".ljust(maxChapterDigits, "_")
db_print("datetimesortkey_chapter_number, chapter: " + chapter, 38)
timeVal = Search.changed_time_key(x)
timeStr = timeVal.strftime("%y%m%d_%H%M%S")
answer = chapter + "_" + timeStr
db_print("datetimesortkey_chapter_number, answer: " + answer, 41)
return answer
示例2: datetimesortkey
# 需要導入模塊: import Search [as 別名]
# 或者: from Search import changed_time_key [as 別名]
def datetimesortkey(meta):
return Search.changed_time_key(meta)