-3

I have opened file in Python with code:

fileObject = open('file')

While debbuging in IDE I see that fileObject has many attributes such as:

_CHUNK_SIZE, _finalizing, closed, encoding, ..., name, newlines

I would like to access the attribute name, because sometimes in huge programs, file name and path are generated, and I would like to get content of that attribute.

Prune
  • 76,765
  • 14
  • 60
  • 81
J. Doe
  • 3
  • 2
  • Is there a question somewhere? – pstatix Jun 15 '18 at 14:32
  • I don't see any problem, probably you should also [try something](https://stackoverflow.com/questions/15225557/get-filename-from-file-pointer), I mean, [anything](https://www.google.com/) – leoschet Jun 15 '18 at 14:34
  • Sorry, but I didn't know how to translate my question and queries like "get object variable" or "get object properties" were pushing me to answers for questions like "how to pass argument to function" – J. Doe Jun 15 '18 at 15:06

1 Answers1

0
In [1]: f = open('test')

In [2]: f.name
Out[2]: 'test'
Eugene Primako
  • 2,767
  • 9
  • 26
  • 35