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