Python日期与字符串互转
import datetime #str -> date detester = '2017-01-01' date = datetime.datetime.strptime(detester,'%Y-%m-%d') #date -> str date = datetime.now() detester = date.strftime('%Y-%m-%d')
import datetime #str -> date detester = '2017-01-01' date = datetime.datetime.strptime(detester,'%Y-%m-%d') #date -> str date = datetime.now() detester = date.strftime('%Y-%m-%d')