使用 Python 進行財務預測
Victoria Clark
CGMA Financial Analyst
日期格式可能不同!
可能造成以下挑戰:
無序的鍵值配對
例如:
dictionary = {01: 'Jan'}

| Directive | 意義 | 範例 |
|---|---|---|
| %d | 日(零補齊的十進位) | 01, 02, …, 31 |
| %b | 月的本地縮寫 | Jan, Feb, …, Dec |
| %B | 月的本地全名 | January, …, |
| %m | 月(零補齊的十進位) | 01, 02, …, 12 |
| %y | 年(兩位,零補齊) | 00, 01, …, 99 |
| %Y | 年(四位,含世紀) | 1988, 2001, 2013 |
# 範例:19-02-2018 會寫成:
('19-02-2018', '%d-%m-%Y')
iteritems() 函式# 建立以字串為鍵、整數為值的 dictionary
wordFrequency = {
"Hello" : 7,
"hi" : 10,
"there" : 45,
"at" : 23,
"this" : 77
}
# 使用 for 迴圈走訪 dictionary
for key in wordFrequency:
value = wordFrequency[key]
print(key, " :: ", value)
Hello :: 7
there :: 45
at :: 23
this :: 77
hi :: 10
使用 Python 進行財務預測