python 2种方式获取当前日期

127 阅读1分钟
from datetime import datetime, timedelta, date

# 1)
str(date.today())

# 2)
datetime.now().strftime("%Y-%m-%d")