osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

absolute path to a file


On Fri, 16 Aug 2019 09:00:38 +1000
Cameron Simpson <cs at cskk.id.au> wrote:

> On 15Aug2019 22:52, Manfred Lotz <ml_news at posteo.de> wrote:
> >I did this:
> >from pathlib import Path
> >abs_myfile = Path('./myfile').resolve()
> >which worked fine for me.  
> 
> There is also os.path.realpath(filename) for this purpose. In modern 
> Python that also accepts a Pathlike object.

Thanks for this. 

I changed my code to use your suggestion which seems to
be better for the situation where I used resolve() before.

-- 
Manfred