On Feb 17, 9:21 am, loial wrote:
> Is there anyway, having been passed a file handle, to get the
> filename?
>
> I am assuming not, but thought I would ask
If by file handle you mean the object returned by 'file' and 'open'
functions, it has a name attribute.
If by file handle you mean the file d
loial wrote:
> Is there anyway, having been passed a file handle, to get the
> filename?
>
> I am assuming not, but thought I would ask
>
>
If you mean a Python file object then file.name (but it may not exist on
all file objects).
If you mean a system file handle, then which filename would
On 2/17/09, loial wrote:
>
> Is there anyway, having been passed a file handle, to get the
> filename?
>
> I am assuming not, but thought I would ask
>>> a = open('/etc/passwd')
>>> a.name
'/etc/passwd'
>>>
Best regards,
Nop
--
http://mail.python.org/mailman/listinfo/python-list