Home >Backend Development >Python Tutorial >Python multi-threaded execution of multiple bats

Python multi-threaded execution of multiple bats

高洛峰
高洛峰Original
2017-03-03 14:46:091773browse

This article mainly introduces the implementation code of python multi-threading method to execute multiple bats in detail. Interested friends can refer to the code of

python multi-threading method to execute multiple bats. Interested friends can refer to it.

import threading
from win32api import *

class MyThread(threading.Thread):
  def __init__(self, bat_path, **kwargs):
    threading.Thread.__init__(self, **kwargs)
    self.bat_path = bat_path
    
  def run(self):
    ShellExecute(0, None, self.bat_path, None, "c:", True)
  
for i in range(1,4):
  t = MyThread("c: est" + str(i) + ".bat")
  t.start()

The above is the entire content of this article. I hope it will be helpful to everyone in learning python programming.

For more python multi-threading methods to execute multiple bat related articles, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn