Что-то вы гоните насчет "привычного вида формата 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
BitFuFu Secures Major Mining Deal
BitFuFu signs two-year agreement with Bitmain to purchase up to 80,000 S-series bitcoin mining machines for self-operated mining. More details on the deal here: link
#Bitcoin#BitFuFu#Bitmain#Mining#Miners#Crypto
🖤Blockchain Life 2025 Sum up
Dubai, Oct 23, 2024 — The 13th edition of the Blockchain Life Forum, the premier gathering for cryptocurrency leaders worldwide, recently concluded with an astounding attendance of over 12,119 participants.
😎 The forum showcased over 200 esteemed speakers, featuring industry pioneers and executives from top companies, including #OKX, #CoinMarketCap, #Bitmain, #Bybit, #Binance, #AnimocaBrands, #Circle, #BingX, #ICP, #Kraken, #TON and many more.
📱 The exhibition of crypto companies featured 125 amazingly beautiful booths. Major players such as #OKX, #Bitmain, #BingX, #KuCoin, #Bitget, #ListingHelp, and #Uminers.
🎧 As a spectacular finale to the forum, participants enjoyed the Legendary #AfterParty at one of the world’s premier clubs, SKY2.0. This informal networking event provided a platform for top industry figures to connect, complemented by a dazzling live performance from internationally celebrated artist French Montana, who thrilled over 1,200 attendees with his chart-topping hits.
See you at Blockchain Life 2025!
The early bird tickets and sponsorship application for Blockchain Life 2025 are already open – follow the link:
https://blockchain-life.com