Как заставить код Python ждать, пока вы не закончите редактировать файлPython

Программы на Python
Гость
Как заставить код Python ждать, пока вы не закончите редактировать файл

Сообщение Гость »


[enter image description here][1]I want my python code to wait until I'll finish tou edit a file and then I want him to take the data that I edited.
I tried to use a simple line: x = input() but it didnt work and I tried also to do a while that run until I finish didnt work as well and now I'm trying ti use popen but I'm not good woth it I have exeptions and I dont know why

Код: Выделить всё

edit_file_path = f"files/{self.computer.finger_table.id}/edit_file"
f = open(edit_file_path, "w")
f.write(curr_data)

finish = "no"

while finish != "finish":
finish = input("Enter finish when you finish")

f.close()
edit_file_path = f"files/{self.computer.finger_table.id}/edit_file"
f = open(edit_file_path, "w")
f.write(curr_data)

enter = input("The file is ready to be edited. Open it, edit save and close and hit Enter.")

f.close()


Источник: https://stackoverflow.com/questions/781 ... dit-a-file

Вернуться в «Python»