from datetime import datetime from datetime import timedelta def date_add(date_str, days_count=1): date_list = time.strptime(date_str, "%Y-%m-%d") y, m, d = date_list[:3] delta = timedelta(days=days_count) date_result = datetime(y, m, d) + delta date_result = date_result.strftime("%Y-%m-%d") return date_result
标签:-%,Python,days,datetime,date,result,字符串,格式 From: https://www.cnblogs.com/book-Y/p/16938786.html