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


Python Helper.prettyPrintDate方法代碼示例

本文整理匯總了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))
開發者ID:dirkstahlecker,項目名稱:WordFrequencies,代碼行數:30,代碼來源:WordFrequenciesClass.py


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