我們的團隊在某些情況下需要使用Python 2.4.1。 strptime
不存在於datetime.datetime
模塊中在Python 2.4.1:datetime.datetime.strptime在Python中不存在2.4.1
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
AttributeError: type object 'datetime.datetime' has no attribute 'strptime'
如2.6反對:
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime
<built-in method strptime of type object at 0x1E1EF898>
雖然打字時,我發現它的2.4.1時間模塊中:
Python 2.4.1 (#65, Mar 30 2005, 09:16:17) [MSC v.1310 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strptime
<built-in function strptime>
我認爲strptime
在某一點上移動?什麼是檢查這樣的事情的最好方法。我試圖通過python的發佈歷史,但找不到任何東西。
這說明了一切 - 我認爲我檢查了文檔,看它是否在提及時提及,但我顯然錯過了這一點。謝謝! – Nathan 2011-04-07 19:09:57