Telegram
2
Вклад в тег
import subprocess as sub
import threading as th
import time
def startrar():
with open("test.log", "wb+") as file:
rar = sub.run('"C:\\Program Files\\WinRAR\\Rar.exe" a -r -ep1 -v1g "D:\\mysqlrar" "D:\\Аудиокниги\\book"',
shell=True, stdout=file, stderr=sub.PIPE)
def printpipe():
while True:
with open("test.log", "rb") as file:
print(file.read().decode('cp1251'))
time.sleep(1)
threads = []
threads.append(th.Thread(target=startrar))
threads.append(th.Thread(target=printpipe))
for i in threads:
i.start()
"".join()
происходит её итеративное создание.str.join(iterable) Return a string which is the concatenation of the strings in iterable. A TypeError will be raised if there are any non-string values in iterable, including bytes objects. The separator between elements is the string providing this method.