answer by yourself, the question is closed: what a pit! I first created a time.py file, which conflicts with the method name of pthon, and then I deleted the file, but he actually generated the time.pyc file himself, so he reported an error no matter how to execute it, but the pyc file could not be seen in the editor, so you have to enter the file management and delete it.
Development environment:
mac
python version: 2.7.10
want to get the current time, code:
-sharp -*- coding: utf-8 -*-
import datetime,time
now = time.strftime("%H")
print (now)
error message:
AttributeError: "module" object has no attribute "struct_time"
looked up a lot of information, but it didn"t work. Later, I installed python3, and then executed it.
but some of my things depend on python2,. I can"t use 3. Have you encountered this problem