Editor Module Question
procryon last edited by
Hey all, quick question about the editor module here. For the .openfile() function, it gives me an error when I put the name of the file I want to open. After reading on the forum, it says to use the filepath. As much as I tried to find a way, I’ve not been able to get the filepath. The file is just in a folder called Brain. Thanks in advance.
JonB last edited by
Phuket2 last edited by Phuket2
import os _root_path = os.path.expanduser('~/Documents') _my_dir = 'Brain' _my_file_name = 'yourfile.txt' my_path = os.path.join(_root_path, _my_dir, _my_file_name) print(my_path) with open(my_path, "w") as f: f.writelines("Hello World")