Jul-04-2018, 06:27 AM
(Jul-04-2018, 03:39 AM)mmaz67 Wrote: how do i go one level up to /in_file directory?You can use
os.chdir("..")
Can also use pathlib which has a
parent
method.>>> from pathlib import Path, PurePath >>> >>> p = PurePath(Path.cwd()) >>> p PurePosixPath('/home/mint') >>> p.parent PurePosixPath('/home')