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 金融预测