S
S
SKEPTIC2019-04-17 19:11:46
Python
SKEPTIC, 2019-04-17 19:11:46

Python sleep()?

I use in a Python script: time.sleep(1)
import time wrote.
Running the script on Ubuntu 18.04 gives AttributeError: 'datetime.datetime' object has no attribute 'sleep'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shitskov, 2019-04-17
@Zarom

The entire script had to be posted.
Wangyu that you imported time and datetime at the same time. Add aliases to imports, for example:

import time as t
import datetime as dt

t.sleep(1)

A
Andrey_Dolg, 2019-04-17
@Andrey_Dolg

Wangyu too

...
time = datetime.datetime.now()
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question