New submission from Andrea Moro <andrea.m...@rs-components.com>:

Assuming the given path contains a '~' character, it would be nice to have a 
function to expand the given path so any further calls to an .exists doesn't 
fail.

A prototype of the function could be

        # Expand the home path in *ix based systems if any
        if '~' in s:
            x = [x for x in Path(s).parts if x not in '~']
            p = Path.home()
            for item in x:
                p = p.joinpath(item)

----------
components: Library (Lib)
messages: 345379
nosy: Andrea Moro
priority: normal
severity: normal
status: open
title: Pathlib: Add an expandUserPath method or argument
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37255>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to