Функция dir() - удобна для получения списка атрибутов у любого объекта.
Ранее я писал про функцию __dir__() в модуле (не путайте её с переменной __all__(), которая указывает список объектов для импорта если встречается конструкция from module import *).
Скорее всего вы уже знаете как использовать функцию dir(). Любой объект может реализовать метод __dir__() чтобы указать список имеющийхся и динамических атрибутов. И функция dir() поможет получить список этих атрибутов.
>>> dir(str)
['__add__', '__class__', '__contains__', ...]
У этой функции есть еще один способ применения. Её можно вызвать без аргумента, и в таком случае она вернёт список имён в текущем неймспейсе.
>>> dir()
['__builtins__', '__doc__', '__file__', ...]
>>> def test():
>>> x = 1
>>> print(dir())
>>> test()
['x']
#basic#tricks
🕵️#MEGA Bubblemaps: MEGA tokens were distributed among 8,360 addresses, with approximately 50% of addresses still holding all the tokens. About 40% of addresses have sold them completely, and around 10% of addresses have sold only a portion of the coins. link
Guillaume Faye left us on March 6, 2019, at the age of 69. He was a unique figure who leaves behind an extensive body of work. Like the ancient Greek heroes of old, he will achieve immortality if we continue to share his ideas. Guillaume laid the foundations—now it is up to us, dear comrades, to build the sanctuary of European civilization!
#MEGA
¿Que puede hacer este bot?
@MegaUploadXbot
Este bot cargará archivos y vinculará directamente a su cuenta de Mega entre otras características.
Idioma: inglés
(Visto en @botsgram_cu)
#mega