01/10/2018, 17:29

Làm sao để print ra theo thời gian trong Python

  • Em mới học python thôi ạ!
  • Mọi người cho em hỏi làm sao để chạy print theo thời gian nhỉ? Ví dụ như đến 2s là nó sẽ chạy print (“1”), 4s là nó sẽ chạy print (“2”), kiểu như để in ra lyric bài hát ấy!
  • Em cám ơn ạ!
HK boy viết 19:37 ngày 01/10/2018

Dùng time.sleep(...) kết hợp với print(...).

Python Central – 23 Jul 13

Python's time.sleep() - Pause, Stop, Wait or Sleep your Python Code | Python...

A look into Python's time.sleep() function - by letting you pause, wait, sleep, or stop your Code. We look at the syntax, an example and the accuracy.

Bài liên quan
0