小编wig*_*les的帖子

不能在python中"导入时间",得到'AttributeError:struct_time'如何解决?

在Snow Leopard上运行python,我无法导入'time'模块.适用于ipython.没有加载任何.pythonrc文件.使用相同解释器'导入时间'的脚本运行正常.不知道如何解决这个问题.有人有想法吗?

[wiggles@bananas ~]$ python2.6
Python 2.6.6 (r266:84292, Sep  1 2010, 14:27:13) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "time.py", line 4, in <module>
    t = now.strftime("%d-%m-%Y-%H-%M")
AttributeError: struct_time
>>> 
[wiggles@bananas ~]$ ipython-2.6 
Python 2.6.6 (r266:84292, Sep  1 2010, 14:27:13) 
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced …
Run Code Online (Sandbox Code Playgroud)

python import time

4
推荐指数
1
解决办法
2697
查看次数

标签 统计

import ×1

python ×1

time ×1