If I have a file pointer, is it possible to get the file name?
fp = open("C:\hello.txt")
Is it possible to get hello.txt using fp?
Yes. You will receive it through fp.name . Example:
fp.name
>>> f = open('data.py') >>> f.name 'data.py'
Docs file here