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

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top