Что-то вы гоните насчет "привычного вида формата 755 и 644". Я вот вообще не понял что это!😳
Действительно, что означают цифры которые мы получили в прошлом посте?
Это кодировка, заключающая в себе режимы доступа к файлу.
Подробней можно почитать в статье про chmod.
Там можно увидеть альтернативное обозначение того же самого с помощью символов r w x, что значит чтение, запись, исполнение.
Чтобы преобразовать восьмеричное число в такое обозначение в Python есть готовая функция
>>> stat.filemode(0o755)
'?rwxr-xr-x'
Мы видим 3 группы по 3 символа, дающие 3 типа доступа для 3 типов юзеров.
А что за знак вопроса в начале?
Давайте передадим в эту функцию необрезанное значение от os.stat
>>> stat.filemode(os.stat(path).st_mode)
'drwxr-xr-x'
Это данные, которые мы безжалостно обрезали в прошлый раз😼
Первый символ обозначает тип объекта. Это может быть файл (-), директория (d) или симлинк (l).
Вот простая схема данной кодировки
[1][3][3][3]
│ │ │ │
│ │ │ └──> Others Permissions
│ │ └─────> Group Permissions
│ └────────> Owner Permissions
└───────────> File Type
(разверните экран если вы с телефона)
Если вы попробуете получить пермишены для симлинка то получите пермишены для файла
>>> path = '.venv/bin/python3'
>>> stat.filemode(os.stat(path).st_mode)
'-rwxr-xr-x'
Чтобы получить свойства именно симлинка, нужно это явно указать
>>> stat.filemode(os.stat(path, follow_symlinks=False).st_mode)
'lrwxrwxrwx'
#tricks#basic
📰US stock prices soar in early Asian trading after truce news
🔗https://top-news.shepherdgazette.com/us-stock-prices-soar-early-asian-trading-truce/?utm_source=telegram&utm_medium=social&utm_campaign=zimm-distribute
via Daily Political Press
#Asian#TopNews#News
News: #Ethiopia, #Asian Infrastructure Investment Bank discusse support for Bishoftu airport project
Ethiopia’s Minister of Finance, Ahmed Shide, has held discussions with the President of the Asian Infrastructure Investment Bank (#AIIB) on potential financing support for the planned #Bishoftu International Airport project.
According to a statement from the Ministry of Finance, the meeting focused on strengthening cooperation between Ethiopia and the multilateral lender, with particular emphasis on priority infrastructure and development initiatives.
The two sides also explored avenues to expand collaboration in mobilizing private sector financing.
A week ago Addis Standard reported that Ahmed Shide, Ethiopia’s Minister of Finance, held high-level discussions with a delegation from the #China Export-Import (Exim) Bank and the Chinese Ambassador to Ethiopia, Chen Hai, the talks centered on exploring financing options for the construction of the Bishoftu....
Read more: https://addisstandard.com/?p=56203