Python Forum
Running a few lines of code as soon as my timer ends
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running a few lines of code as soon as my timer ends
#1
Basically near the end of my script I added a timer that will count down the exact time until it hits 0. Lets say I make it wait 100 seconds, it will start counting down
100.000000000000000
99.999999999328834
99.9987393939399
99.000003273738
and so on, what I need is to make the lines of code after the timer run as soon as possible, what I want to figure out, is how to run it as fast as possible that my computer can handle.
Reply
#2
I don't understand what you want. You set a timer. When do you want the code to execute - immediately? Once the timer runs down to 0?
Reply
#3
(Feb-23-2021, 10:14 PM)jefsummers Wrote: I don't understand what you want. You set a timer. When do you want the code to execute - immediately? Once the timer runs down to 0?

Once it hits 0
Reply
#4
Like this
import time
print('sleeping')
time.sleep(7)
print('woke up')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in running a code akbarza 7 547 Feb-14-2024, 02:57 PM
Last Post: snippsat
  writing and running code in vscode without saving it akbarza 1 346 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  the order of running code in a decorator function akbarza 2 480 Nov-10-2023, 08:09 AM
Last Post: akbarza
  Regular Expression search to comment lines of code Gman2233 5 1,595 Sep-08-2022, 06:57 AM
Last Post: ndc85430
  Code running many times nad not just one? korenron 4 1,326 Jul-24-2022, 08:12 AM
Last Post: korenron
  Error while running code on VSC maiya 4 3,551 Jul-01-2022, 02:51 PM
Last Post: maiya
  pywin32: Outlook connection ends with 'operation aborted' on one machine tstone 0 2,325 May-03-2022, 04:29 AM
Last Post: tstone
  code running for more than an hour now, yet didn't get any result, what should I do? aiden 2 1,424 Apr-06-2022, 03:41 PM
Last Post: Gribouillis
  Why is this Python code running twice? mcva 5 5,162 Feb-02-2022, 10:21 AM
Last Post: mcva
  Python keeps running the old version of the code quest 2 3,646 Jan-20-2022, 07:34 AM
Last Post: ThiefOfTime

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020