Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Script to be executed in specific time.

I've made up a research about how can I make a script to be executed in spcecific time but without any result.
So the main question is : is it possible? and if so how ?

P.S. The best I have made up to now is something like : time.sleep("seconds").
Could you give an example of why you re trying to do? Your explanation isn't entirely clear. However judging by what you have, it should be possible.
Okay a quick example :

PHP Code

<?php 
import time

while time == 21:25:
....
....
....
.... 
Use cron or Windows Task Scheduler. They should fit your needs.
You could try with time.gmtime()
for example, look at this:
Code
import time
print (str(time.gmtime()[3])+":"+str(time.gmtime()[4])+":"+str(time.gmtime()[5]))
#output will be the time in the format HH:MM:SS, example is 20:41:24

You could use this to do what you're trying to do:
Code
import time
time = "20:45"

while (str(time.gmtime()[3])+":"+str(time.gmtime()[4])) == time:
    print ("running during this minute only")
Thanks guys problem solved ! 🤝
(Feb 19, 2014 01:44 PM)ImportUsername Wrote:  You could try with time.gmtime()
for example, look at this:
Code
import time
print (str(time.gmtime()[3])+":"+str(time.gmtime()[4])+":"+str(time.gmtime()[5]))
#output will be the time in the format HH:MM:SS, example is 20:41:24

You could use this to do what you're trying to do:
Code
import time
time = "20:45"

while (str(time.gmtime()[3])+":"+str(time.gmtime()[4])) == time:
    print ("running during this minute only")

Couldn't have said it better myself.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by sid123Jun 20, 2022 11:31 AM 3 171 Jun 20, 2022 11:31 AM
Last Post: dinosaur770
[C#] by RedirectMeSep 14, 2021 08:49 AM 8 290 Sep 14, 2021 08:49 AM
Last Post: RedirectMe
[C#] by PitbullT0rJun 15, 2021 03:39 AM 5 312 Jun 15, 2021 03:39 AM
Last Post: Mistercoenkel