Advertisement
ElRandir42

Untitled

Dec 3rd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. """
  2. Demonstrates how to use the asyncio compatible scheduler to schedule a job that executes on 3
  3. second intervals.
  4. """
  5.  
  6. import asyncio
  7. import os
  8. from datetime import datetime
  9. import time
  10. from apscheduler.schedulers.asyncio import AsyncIOScheduler
  11.  
  12.  
  13. date_bitch = str(input('Введи время: '))
  14. text_bitch = str(input('Введи текст: '))
  15.  
  16. async def bla(date_bitch, text_bitch):
  17.     print(date_bitch)
  18.     print(text_bitch)
  19.     time_now = str(time.strftime("%Y-%m-%d ", time.localtime()))
  20.     time_now += date_bitch
  21.     print(time_now)
  22.     scheduler = AsyncIOScheduler()
  23.     scheduler.add_job(check, 'date', run_date=time_now, args = [text_bitch])
  24.     scheduler.start()
  25.  
  26.  
  27. async def check(text_bitch):
  28.     print('Poshlo Poehalo')
  29.     for x in range(10):
  30.         time = str(time.strftime("%M:%S", time.localtime()))
  31.         print(f'#{x} |Чек. Текст: {text_bitch}, время сейчас: {time}.')
  32.  
  33. print(str(time.strftime("%M:%S", time.localtime())))
  34. #bla(date_bitch, text_bitch)
  35.  
  36. if __name__ == '__main__':
  37.     #scheduler = AsyncIOScheduler()
  38.     #scheduler.add_job(tick, 'cron', day='*' , hour='*' , minute='*' , second='*/1')
  39.     #scheduler.start()
  40.     print('Go go go Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
  41.  
  42.     # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed.
  43.     try:
  44.         asyncio.get_event_loop().run_until_complete(bla(date_bitch, text_bitch))
  45.         #asyncio.get_event_loop().run()
  46.     except (KeyboardInterrupt, SystemExit):
  47.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement