Что-то вы гоните насчет "привычного вида формата 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
⚠️ We’ve been silent since September 9 on X (twitter) after our account was hacked, but we’ve just recovered it. This came as Venezuela faces new imperialist threats, while VA continues countering mainstream media lies.
👉 Stay tuned for lots of new content: x.com/venanalysis
#Venezuelanalysis
⚠️ Our X (Twitter) account @venanalysis has been hacked, just as US military threats against Venezuela intensify and mainstream media joins the chorus.
We’re working to recover it.
👉 Stay tuned here for updates.
#Venezuelanalysis
Venezuelanalysis is an independent outlet, free from corporate and political backers. Our mission to report on Venezuelan grassroots struggles is unwavering, but we need your support!
📍Make a one-time donation or subscribe to help us reach our goal here: https://venezuelanalysis.com/donate/
#Venezuelanalysis#IndependentJournalism#IndependentMedia#Fundraising
Oppose Trump’s War, Support Venezuelanalysis!
For over 20 years, we’ve stood with the Venezuelan people in their struggle for sovereignty. We’ve exposed US-backed aggression, documented grassroots resistance, and challenged dishonest media narratives.
Every contribution keeps this work alive. Click here to donate 👉https://venezuelanalysis.com/donate/
#Venezuelanalysis#Fundraising2025#IndependentMedia#Venezuela#SupportIndependentMedia
Fundraising 2025! 💪
We launch our yearly fundraising at a moment that feels more critical than ever. With Trump openly threatening to attack Venezuela and the corporate media beating the war drums, independent media must fight back.
For years, Venezuelanalysis has reported from the ground with accuracy and integrity; from documenting popular power to exposing dishonest narratives around sanctions. Today, our task is clear: counter war propaganda and defend peace and Venezuelan sovereignty.
Our work is 100% supported by readers and followers. That’s what keeps us independent. If you value this project, please consider making a donation or becoming a subscriber. Every contribution strengthens our ability to continue reporting in this historic moment.
Click here to donate 👉https://venezuelanalysis.com/donate/
#Venezuelanalysis#Fundraising2025#IndependentMedia#Venezuela#SupportIndependentMedia
🎥 VIDEO | Venezuela's Workers: Bonuses, Frozen Wages, and a Labor Law Under Threat
Venezuela’s minimum wage remains frozen while worker income is increasingly tied to discretionary bonuses. At the same time, proposed changes to the country’s landmark labor law are raising alarm among labor organizations.
Are workers’ rights being quietly dismantled?
Watch the video to learn more: https://youtu.be/rJJLUiLj2NQ
#Venezuela#WorkersRights#LaborLaw#WorkingClass#Venezuelanalysis