При работе с файлами часто нужно знать, где находится сам исполняемый скрипт. Новички могут указывать путь вручную, но Python умеет получать его автоматически с помощью встроенного модуля os.
Функция os.path.abspath(__file__) возвращает абсолютный путь к текущему файлу, а os.path.dirname() — директорию, в которой он находится.
🎯 Итог С помощью os.path.abspath(__file__) и os.path.dirname() можно динамически определять путь к текущему файлу и его директории — это удобно для настройки путей и работы с файлами без хардкода.
При работе с файлами часто нужно знать, где находится сам исполняемый скрипт. Новички могут указывать путь вручную, но Python умеет получать его автоматически с помощью встроенного модуля os.
Функция os.path.abspath(__file__) возвращает абсолютный путь к текущему файлу, а os.path.dirname() — директорию, в которой он находится.
🎯 Итог С помощью os.path.abspath(__file__) и os.path.dirname() можно динамически определять путь к текущему файлу и его директории — это удобно для настройки путей и работы с файлами без хардкода.
The channel also called on people to turn out for illegal assemblies and listed the things that participants should bring along with them, showing prior planning was in the works for riots. The messages also incited people to hurl toxic gas bombs at police and MTR stations, he added. But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered." Content is editable within two days of publishing Telegram desktop app: In the upper left corner, click the Menu icon (the one with three lines). Select “New Channel” from the drop-down menu. How to Create a Private or Public Channel on Telegram?
from us