Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How can I turn an absolute path into a relative path within a function?

$
0
0

I'm currently facing the problem that I'm working with different files. Within some of those files are other files - absolute files - I do not want to change them all to relative path since then I'll run into another problem. So my question is whether I can indicate a relative path within a function with e.g. adding two dots. So this is the code snipped:

    if not all(np.array(skills_dict['snames']) == df_cube['img_path'].values)

So 'img_path' is the absolute path and I would like to make it relative for this function, something quirky like

    df_cube['..'+'img_path'].values

Maybe someone could help me with that. Highly appreciated! Thanks!


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>