タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

Pythonとthreadingに関するdarwiniaのブックマーク (1)

  • Pythonでhourglassメモ - Λάδι Βιώσας

    2ちゃんのPythonスレッドみてたら、おおー面白い、というコードがあったので、勝手にまとめてスレから転載してみました。転載元 時間のかかる処理をしてる間、1秒おきにピリオドを表示する、というコードです。 # -*- coding: cp932 -*- import sys, time, threading class myThread(threading.Thread): alive = True def run(self): while self.alive: sys.stdout.write('.') time.sleep(1) def kill(self): self.alive = False def sandglass(func): """時間経過を表示させるデコレータ """ def wrapper(*args, **keys): try: t = myThread() pr

    Pythonでhourglassメモ - Λάδι Βιώσας
  • 1