Is it possible to have a program work for a certain amount of time before expiring? For example, I have this code:
from time import sleep
import sys
print('Hello')
sleep(200)
print('Still here?')
sys.exit()
This code exists after 200 seconds but if a user runs it again it will launch. Is there a way for it to permanently not launch?
First of all use this script to get the current time
>>> import datetime
>>> print(datetime.datetime.now())
2009-01-06 15:08:24.789150
Then add this to your script
import datetime
from time import sleep
import sys
print('Hello')
if '2009-01-06' in datetime.datetime.now():
pass
else:
print('Still here?')
sys.exit()
This will expire in 1 day. You can of course customize it to your liking