How can I create a file in python one directory up, without using the full path?
I would like a way that worked both for windows and linux.
Thanks.
Use os.pardir (which is probably always "..")
os.pardir
".."
import os fobj = open(os.path.join(os.pardir, "filename"), "w")