pythonを使ってマルチスレッド処理を行ないたい. pythonでスレッドを扱うにはthreadingモジュールを利用する. threadingモジュールでスレッドを扱うには二つの方法がある. threading.Threadのサブクラスを作る. threading.Threadのインスタンスを作る. それぞれについてサンプルを示す. サブクラスを作る サブクラスを作り,runにオーバーライドしてスレッド処理を実装する. 以下の例ではt秒おきにn回,時刻を表示するメソッドをrunとして実装した. import threading import time import datetime class TestThread(threading.Thread): """docstring for TestThread""" def __init__(self, n, t): super(Test
![Pythonでマルチスレッド処理 - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/cbc1f0f7d57c0fbd7dc87d81bc07542c36a83eff/height=288;version=1;width=512/https%3A%2F%2Fcdn.qiita.com%2Fassets%2Fqiita-fb-2887e7b4aad86fd8c25cea84846f2236.png)