absolute path to a file

Manfred Lotz ml_news at posteo.de
Thu Aug 15 23:44:55 EDT 2019


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





More information about the Python-list mailing list