As in the title, how can I turn threads into processes in the program, the program will create files named in the form of the file creation date, but I would like to execute it using processes, could anyone give me tips on how to do this correctly?
import datetime
import threading
def file():
try:
filename = datetime.datetime.now()
with open(filename.strftime("%Y%m%d-%H%M%S") + ".txt", "w") as file:
file.write("")
except FileExistsError:
print("file already exists")
threads = []
for i in range(0, 50):
t = threading.Thread(file())
threads.append(t)
t.start()