On 18Sep2019 03:36, eryk sun wrote:
On 9/17/19, Cameron Simpson wrote:
If you just want this for your running program's internals this may not
matter, but if you're recording the result somewhere then abspath might
get you a more "stable" path in the above scenario.
If a path has ".." compo
Cameron Simpson writes:
> On 17Sep2019 15:09, Hongyi Zhao wrote:
>>See the following two methods for obtaining the file's path:
>>
>>os.path.realpath(file)
>>or
>>os.path.abspath(os.path.expanduser(file))
>>
>>Which is more robust?
>
> My inclination is often to use abspath, because it may bette
On 9/17/19, Cameron Simpson wrote:
>
> If you just want this for your running program's internals this may not
> matter, but if you're recording the result somewhere then abspath might
> get you a more "stable" path in the above scenario.
If a path has ".." components, the abspath() result may be
On 17Sep2019 15:09, Hongyi Zhao wrote:
See the following two methods for obtaining the file's path:
os.path.realpath(file)
or
os.path.abspath(os.path.expanduser(file))
Which is more robust?
They're probably equally robust (BTW, you need the expanduser in the
realpath call as well, if your f