+ 3
Python loops with time interval
Is it possible to loop a code , for example a password generator with time interval? So that it could act like Google Authenticator.
5 Respostas
+ 1
Not for Python but have used similar functions in C. Here is the link from the Python documentation( https://docs.python.org/3/library/time.html#module-time ). It states that the function availability is dependent on your Python version. Something in here should be able to help you be more precise in the time calculation instead of trying to just create a loop to simulate a time delay.
+ 1
There is a time module with functions that you can use to handle tracking time or possibly using the sleep function dependent on how you want to design it.
+ 1
Robb , have you ever used it yourself?
Thanks for replying though
+ 1
You can also use the builtin threading library to schedule repeated action in python, like write a function that calls itself after a certain amount of time.
A simple example is here:
https://stackoverflow.com/questions/8600161/executing-periodic-actions-in-python
+ 1
Thank you very much Tibor !