本文整理匯總了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))