I know I can use the function 'os.open' to deal with '.txt' files. But nevertheless I tried to open a '.jpg' file using this function as shown in the code below:
import os
f1 = os.open('imagem.jpg', os.O_RDONLY)
When I call f1 object to see what is inside it, python returns to me a integer that changes according to the number of times I have run the 'f1 = os.open('imagem.jpg', os.O_RDONLY)' code.
For example, the first time I run 'f1 = os.open('imagem.jpg', os.O_RDONLY)', f1 will assume 1, second time, 2, so on...
When I run the code below to see the methods and atributes of f1:
dir(f1)
python returns it to me:
['__abs__',
'__add__',
'__and__',
'__bool__',
'__ceil__',
'__class__',
'__delattr__',
'__dir__',
'__divmod__',
'__doc__',
'__eq__',
'__float__',
'__floor__',
'__floordiv__',
'__format__',
'__ge__',
'__getattribute__',
'__getnewargs__',
'__gt__',
'__hash__',
'__index__',
'__init__',
'__init_subclass__',
'__int__',
'__invert__',
'__le__',
'__lshift__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__neg__',
'__new__',
'__or__',
'__pos__',
'__pow__',
'__radd__',
'__rand__',
'__rdivmod__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rfloordiv__',
'__rlshift__',
'__rmod__',
'__rmul__',
'__ror__',
'__round__',
'__rpow__',
'__rrshift__',
'__rshift__',
'__rsub__',
'__rtruediv__',
'__rxor__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__truediv__',
'__trunc__',
'__xor__',
'as_integer_ratio',
'bit_length',
'conjugate',
'denominator',
'from_bytes',
'imag',
'numerator',
'real',
'to_bytes']
Some one can explain to me what is happening?