E
E
Emil Timerbaev2020-08-27 21:42:32
Python
Emil Timerbaev, 2020-08-27 21:42:32

Accessing a file whose part of the path is in a variable?

I have some variable, let's say abc, аbc== (let's say) pyti , and I need to access the file that is in the folder, part of the path of which lies in abc (this is necessary so that the path can change automatically, maybe you can tell another way)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Guerro69, 2020-08-27
@MrDlop

import os
currentPath = os.path.dirname(__file__)
abc = os.path.join(currentPath, "pyti")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question