转换为日期我想下面的字符串转换为日期蟒蛇,如何去了解这一点,蟒蛇得到从字符串
>>> d= "1997-01-29 00:00:00+00:00"
>>> import datetime
>>> datetime.datetime.strptime(d, '%Y-%m-%d').date()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: 00:00:00+00:00
无论是分好输入,或使用*实际上代表了你解析*数据的格式。 – jonrsharpe
什么版本的python? – sbarber2
python strptime不会喜欢时区偏移片中的冒号。看看[在python中将字符串转换为datetime对象](http://stackoverflow.com/questions/2609259/converting-string-to-datetime-object-in-python) – sbarber2