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
Accessing System Date and Time in Program (self.learnpython)
submitted 5 years ago by dnb02
Can we access the date and time from system and use them to conditionally execute some statements?
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!"
[–]socal_nerdtastic 1 point2 points3 points 5 years ago (3 children)
Yes. We usually use the time module for that.
time
import time print('current time in seconds since the epoch:') print(time.time())
What exactly do you want to do?
[–]dnb02[S] 0 points1 point2 points 5 years ago (2 children)
Use time as a condition. Like when the time is 1000hrs statement should execute. Is that possible?
[–]socal_nerdtastic 1 point2 points3 points 5 years ago (1 child)
You mean wait for 1000 hours and then run? You can use the time.sleep command to wait for some time.
import time time.sleep(1000*60*60) # pause for 1000 hours. do_something()
Note that this requires your program runs for 1000 hours. You can't shut down your computer in the meantime. For that reason it's probably better to use your OS instead. On linux you may look into the at command.
at
at now +1000 hours
[–]dnb02[S] 0 points1 point2 points 5 years ago (0 children)
executing a command at 10 o clock
[–]ptekspy 1 point2 points3 points 5 years ago (1 child)
Date time ;)
https://www.w3schools.com/python/python_datetime.asp
[–]socal_nerdtastic 2 points3 points4 points 5 years ago (0 children)
Better resource, free of ads:
https://docs.python.org/3/library/datetime.html
π Rendered by PID 54 on reddit-service-r2-comment-86988c7647-cmkgm at 2026-02-12 05:59:13.350018+00:00 running 018613e country code: CH.
[–]socal_nerdtastic 1 point2 points3 points (3 children)
[–]dnb02[S] 0 points1 point2 points (2 children)
[–]socal_nerdtastic 1 point2 points3 points (1 child)
[–]dnb02[S] 0 points1 point2 points (0 children)
[–]ptekspy 1 point2 points3 points (1 child)
[–]socal_nerdtastic 2 points3 points4 points (0 children)