os.path.expanduser analogue

Twan van Laarhoven twanvl at gmail.com
Tue Nov 22 15:36:14 CET 2011


On 21/11/11 02:36, Ben Gamari wrote:
> On the whole, the filepath package does an excellent job of providing
> basic path manipulation tools, one weakness is the inability to resolve
> "~/..." style POSIX paths. Python implements this with
> os.path.expanduser. Perhaps a similar function might be helpful in
> filepath?


On windows there are folders like %UserProfile% and %ProgramFiles%. 
There is a function in the API, ExpandEnvironmentStrings, for expanding 
them.

I think it makes sense that, if a function that expands "~" is added to 
filepath, it should do also this expanding on windows. That also means 
that 'expandUser' is not the right name.


Twan



More information about the Libraries mailing list