user49404
user49404

Reputation: 907

What path is represented by "../" in python?

In this code:

import scipy.io as scpio
scpio.loadmat('../data/file.mat')

Which path is represented by '../', and how can I print this path?

I am running anaconda, and I assumed that '../' would represent the home directory in parentheses before each anaconda command prompt line, but that guess was incorrect.

Upvotes: 0

Views: 51

Answers (1)

R Nar
R Nar

Reputation: 5515

You can make use of os.path.realpath

from os import path as op
op.realpath('../')

the ../ usually means the directory above your cwd

Upvotes: 3

Related Questions