I have a script that needs to execute the following at different lines in the script:
today_date = datetime.date.today()
date_time = datetime.strp(date_time_string, '%Y-%m-%d %H:%M')
In my import
statements I have the following:
from datetime import datetime
import datetime
I get the following error:
AttributeError: 'module' object has no attribute 'strp'
If I change the order of the import
statements to:
import datetime
from datetime import datetime
I get the following error:
AttributeError: 'method_descriptor' object has no attribute 'today'
If I again change the import
statement to:
import datetime
I get the following error:
AttributeError: 'module' object has no attribute 'strp'
What is going on here and how do I get both to work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…