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.
我有一个格式为“30DEC05”的字符串,在此示例中表示 2005 年 12 月 30 日。如何将此字符串解析为日期时间?
>>> from datetime import datetime >>> datetime.strptime('30DEC05', '%d%b%y') datetime.datetime(2005, 12, 30, 0, 0)
注意:%b取决于您的语言环境。
%b