Andrew Fong wrote:
Newbie question:
Let's say I open a new file for writing in a certain path. How do I
get that path back?
Example:
f = open('/some/path/file.ext')
some_function(f)
'/some/path/file.ext'
Does some_function(f) already exist? And if not, how would I define
it?
-- Andrew
Rea
On 4 juil, 20:37, Andrew Fong <[EMAIL PROTECTED]> wrote:
> Newbie question:
>
> Let's say I open a new file for writing in a certain path. How do I
> get that path back?
>
> Example:
>
> >>> f = open('/some/path/file.ext')
> >>> some_function(f)
>
> '/some/path/file.ext'
>
> Does some_function(f) a
f.name will return the path. But if you want to guarantee getting the
absolute pathname use os.path.abspath
>>> import os
>>> os.path.abspath(f.name)
'/some/path/file.ext'
On Fri, Jul 4, 2008 at 1:37 PM, Andrew Fong <[EMAIL PROTECTED]> wrote:
> Newbie question:
>
> Let's say I open a new file
Newbie question:
Let's say I open a new file for writing in a certain path. How do I
get that path back?
Example:
>>> f = open('/some/path/file.ext')
>>> some_function(f)
'/some/path/file.ext'
Does some_function(f) already exist? And if not, how would I define
it?
-- Andrew
--
http://mail.pyth