本文整理汇总了Python中Helper.Helper.prettyPrintDate方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.prettyPrintDate方法的具体用法?Python Helper.prettyPrintDate怎么用?Python Helper.prettyPrintDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helper.Helper
的用法示例。
在下文中一共展示了Helper.prettyPrintDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: overallAnalytics
# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import prettyPrintDate [as 别名]
def overallAnalytics(self):
print('Total number of entries: ', end=' ')
print(len(self.wordCountOfEntriesDict))
print('First entry: ', end=' ')
print(Helper.prettyPrintDate(self.firstDate))
print('Last entry: ', end=' ')
print(Helper.prettyPrintDate(self.mostRecentDate))
print('Total days from first to last entry: ', end=' ')
totalDays = self.mostRecentDate - self.firstDate #this is correct
days = totalDays.days
print(days)
print('Percentage of days from first to last with an entry: ', end=' ')
print(str(round(float(len(self.wordCountOfEntriesDict)) / days * 100, 2)) + '%')
print('Average length per entry: ', end=' ')
numberOfEntries = len(self.wordCountOfEntriesDict)
sumOfLengths = 0
longestEntryLength = 0
for date in list(self.wordCountOfEntriesDict.keys()):
length = self.wordCountOfEntriesDict[date]
if length > longestEntryLength:
longestEntryLength = length
longestEntryDate = date
sumOfLengths += length
print(round(float(sumOfLengths) / numberOfEntries, 2))
print('Longest entry: ' + str(longestEntryLength) + ' words on ', end=' ')
print(Helper.prettyPrintDate(longestEntryDate))
print('Total number of words written: ', end=' ')
print(locale.format("%d", self.totalNumberOfWords, grouping=True))