python: question about files in Python.

Tim Peters at
Sun Feb 16 01:22:44 CET 2003

> 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?

In an interactive shell, and where f is such a file object, try dir(f).  The
attribute whose name is 'name' may be suggestive <wink>.

More information about the Python-list mailing list