I was hoping you guys would consider creating function in os.path or otherwise that would find the full path of a file when given only it's base name and nothing else.I have been made to understand that this is not currently possible.If it is in any can you please inform me of it[i know this is not a tutorial] but please i need thiis badly if it's possible.Thank you _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
Joshua> I was hoping you guys would consider creating function in Joshua> os.path or otherwise that would find the full path of a file Joshua> when given only it's base name and nothing else.I have been made Joshua> to understand that this is not currently possible.If it is in Joshua> any can you please inform me of it[i know this is not a Joshua> tutorial] but please i need thiis badly if it's possible.Thank Joshua> you Joshua, This topic should be discussed (at least until there is a concrete proposal) on the Usenet newgroup comp.lang.python (a.k.a. python-list@python.org). It would be helpful if you presented a concrete example. As stated though there is no unique file that matches a given basename. You might also want to check out the glob module to see if it addresses your needs. Skip
JOSHUA ABRAHAM wrote:
I was hoping you guys would consider creating function in os.path or otherwise that would find the full path of a file when given only it's base name and nothing else.I have been made to understand that this is not currently possible.
Does os.path.abspath() do what you want? If not, what exactly *do* you want? -- Greg
On 4/30/07, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
JOSHUA ABRAHAM wrote:
I was hoping you guys would consider creating function in os.path or otherwise that would find the full path of a file when given only it's base name and nothing else.I have been made to understand that this is not currently possible.
Does os.path.abspath() do what you want?
If not, what exactly *do* you want?
probably: def find_in_path(filename): for path in os.environ['PATH'].split(os.pathsep): if os.path.exists(filename): return os.path.abspath(os.path.join(path, filename)) -Mike
参加者 (4)
-
Greg Ewing
-
JOSHUA ABRAHAM
-
Mike Klaas
-
skip@pobox.com