轉換爲日期我想下面的字符串轉換爲日期蟒蛇,如何去了解這一點,蟒蛇得到從字符串
>>> 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