Python ImportError: No module sleep found

☆樱花仙子☆ 提交于 2019-12-02 10:45:22
Tanveer Alam

You imported time's built-in function sleep in wrong way, from keyword was missing. It should be like this :

from time import sleep

Instead of :

import time import sleep

This might be helpful.

just change this line

import time import sleep 

to

from time import sleep

your code will start working.

import time import sleep => from time import sleep

As others have mentioned , use from time import sleep to use directly or use time.sleep() in appropriate place of your code.

E.g

from time import sleep
sleep(1)  # sleep for a second

#  OR 

import time
time.sleep(1)  # sleep for a second
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!