Pour compter les jours avant un certain événement. C'est super utile.. je crois
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031
  1. from datetime import date
  2. import time
  3. from config import date_dest, evenement
  4. from get_date import get_date
  5. from twitter import tweet
  6. from calcul import calcul
  7. import sys
  8. def main():
  9. while 1 :
  10. print("Twitter-DayCounter")
  11. today = date.today()
  12. dest = get_date(date_dest)
  13. temps = calcul(today, dest)
  14. if temps == 0 :
  15. print("IT'S TIME !")
  16. tweet(u"Fin du confinement ! Maintenant, je retourne dans ma chambre. ")
  17. sys.exit(0)
  18. else :
  19. message = "Il reste " + temps + " jours, avant " + evenement + " !"
  20. tweet(message)
  21. time.sleep(86400)
  22. if __name__ == '__main__':
  23. try :
  24. main()
  25. except KeyboardInterrupt :
  26. print("Fermeture du programme...")