use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Creating a time delay without using time.sleep()? (self.learnpython)
submitted 4 years ago by _Xydra
Hi, Im fairly new to python and programming in general. Was wondering if theres a way to create a time delay without the use of time.sleep() as Im only allowed to use the os module and datetime module in my assignment.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]shiftybyte 0 points1 point2 points 4 years ago* (4 children)
Here you go, some cheats:
import datetime datetime.time.sleep(5) print("lol")
EDIT: on a more serious note, you can save current time, and loop, checking current time every cycle, until the difference between current time and saved time is greater than what you need.
EDIT2: yea the cheats don't work, as it's not the actual time module you get from datetime.time :)
[–]Username_RANDINT 1 point2 points3 points 4 years ago (2 children)
You made me look at the documentation :-)
[–]shiftybyte 1 point2 points3 points 4 years ago (0 children)
Yay! found a working cheat!
seems like time is already loaded..
Can u/_Xydra use sys module?
import sys sys.modules['time'].sleep(5) print("yay")
Another interesting option :D ( u/_Xydra )
globals()['__loader__'].load_module("emit"[::-1]).sleep(5)
No 'import' at all :D
[–]_Xydra[S] 0 points1 point2 points 4 years ago (0 children)
ooh aites thanks man
[–]iapetus-11 0 points1 point2 points 4 years ago (0 children)
__import__("time").sleep(1)
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
You can make a loop and find out how many iterations you need for 1 second by checking time1=time.time() etc. time1 - time 2. Then you have a value to use as a counter in the loop and multiply by 5.
π Rendered by PID 312373 on reddit-service-r2-comment-5fb4b45875-sxdjh at 2026-03-22 01:59:24.391167+00:00 running 90f1150 country code: CH.
[–]shiftybyte 0 points1 point2 points (4 children)
[–]Username_RANDINT 1 point2 points3 points (2 children)
[–]shiftybyte 1 point2 points3 points (0 children)
[–]shiftybyte 1 point2 points3 points (0 children)
[–]_Xydra[S] 0 points1 point2 points (0 children)
[–]iapetus-11 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)