Getting a path from a file object

A

Andrew Fong

Newbie question:

Let's say I open a new file for writing in a certain path. How do I
get that path back?

Example:
'/some/path/file.ext'

Does some_function(f) already exist? And if not, how would I define
it?

-- Andrew
 
B

bruno.desthuilliers

Newbie question:

Let's say I open a new file for writing in a certain path. How do I
get that path back?

Example:


'/some/path/file.ext'

Does some_function(f) already exist?

Nope. But:
And if not, how would I define
it?

Not sure it's worth defining a function:

def some_function(f):
return f.name
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top