Answer the question
In order to leave comments, you need to log in
Is the created file being deleted?
I wrote a simple code that, on clicking a button, creates a notebook with the result, here is the code.
def save_result():
with open("result.txt", "a") as f:
z = ui.label_6.text()
pm = ui.label_8.text()
time = datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S")
f.write(f"====================\n\nРезультат работы!\n/z -{z}\n/pm -{pm}\nВремя сохранения: {time}\n\n====================")
with open("result.txt", "r") as fl:
print(fl.read())
ui.pushButton_2.clicked.connect(save_result)
Answer the question
In order to leave comments, you need to log in
A typo in the code:
print(f.read())
but you need:
print(f1.read())
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question