我在 Python 中有一个表示 unix 时间戳(即“1284101485”)的字符串,我想将其转换为可读日期。当我使用 time.strftime
时,我得到一个 TypeError
:
>>>import time
>>>print time.strftime("%B %d %Y", "1284101485")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument must be 9-item sequence, not str
原文由 VeryNewToPython 发布,翻译遵循 CC BY-SA 4.0 许可协议
使用
datetime
模块: