Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用此处指定的格式解析 RSS 提要:http ://www.feedparser.org/docs/date-parsing.html
日期元组 (2009, 3, 23, 13, 6, 34, 0, 82, 0)
我对如何将其转换为 MySQL 日期时间格式 (Ymd H:M:S) 感到有些困惑?
tup = (2009, 3, 23, 13, 6, 34, 0, 82, 0) import datetime d = datetime.datetime(*(tup[0:6])) #two equivalent ways to format it: dStr = d.isoformat(' ') #or dStr = d.strftime('%Y-%m-%d %H:%M:%S')