python: question about files in Python.

Chris Liechti cliechti at gmx.net
Sat Feb 15 19:13:22 EST 2003


"E.A." <thelangleys at attbi.com> wrote in
news:mailman.1045352330.17433.python-list at python.org: 

> Hi there,
>    with the file object generated by file('some_file_name', 'w') is it
>    possible to get the file name from one of the file object's
>    attributes? 

f = file(...)
print f.name

you have the interactive shell (try "dir(f)" or "help(file)") or the python 
docs on your harddisk...

> ------=_NextPart_000_006F_01C2D522.4E1DDEE0
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
...

html not needed here....

chris

-- 
Chris <cliechti at gmx.net>





More information about the Python-list mailing list