Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. state = 'routine'
  2.  
  3. async def start():
  4. while True:
  5. state = input('Enter state')
  6. print(state)
  7.  
  8. async def main():
  9. task = asyncio.Task(start())
  10. await asyncio.sleep(5)
  11. task.cancel()
  12. print(state)
  13. with suppress(asyncio.CancelledError):
  14. await task
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement