Python将日期字符串转换为时间戳

mai*_*elm 1 python date python-2.7

我需要在Python 中将字符串类型Wed,2016年5月18日11:21:35 GMT转换为时间戳.我正在使用:

datetime.datetime.strptime(string, format)
Run Code Online (Sandbox Code Playgroud)

但我不想指定日期类型的格式.

ale*_*cxe 6

但我不想指定日期类型的格式.

然后,让dateutil解析器弄清楚:

>>> from dateutil.parser import parse
>>> parse("Wed, 18 May 2016 11:21:35 GMT")
datetime.datetime(2016, 5, 18, 11, 21, 35, tzinfo=tzutc())
Run Code Online (Sandbox Code Playgroud)