使用 Python 進行財務預測
Victoria Clark
CGMA Financial Analyst
日期:09/10/2018
地區格式差異
標點符號差異

# Import datetime module from datetime import datetimedatetime.strptime(date_string, format)
12-25-2000 --> %m-%d-%Y'
datetime.strptime('12-25-2000', '%m-%d-%Y')print(dt_object.month)
12

split() 函式date = '14/02/2018'# 使用 / 分割日期字串並指派給具名變數 day, month, year = date.split('/')print(year)
2018
使用 Python 進行財務預測