Что-то вы гоните насчет "привычного вида формата 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
🔺“Yemen does not kneel. It responds.”
Yemen shows steadfast solidarity with Palestine, proving through sacrifice and resistance what true commitment to justice means.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺Nicola Hadwa argues that Israel faces collapse in population, economy, and legitimacy, while Palestinian resistance grows stronger.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺“Israeli regime cannot exist in peace”
Nicola Hadwa states that the Palestinian resistance fights bravely against the Israeli regime over the past two years, emphasizing the regime’s failure to achieve its goals.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺“Yemenis are fierce fighters who do not know the meaning of defeat”
According to Nicola Hadwa, Saudi Arabia and the UAE are complicit in the Israeli regime's crimes against the Yemeni people.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺”Yemen showed that Israel’s army is not invincible”
Nicola Hadwa points out that Yemen has shown that the child-killing entity, Israel, is not an invincible army and is, in fact, a considerably a weaker army.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺 Nicola Hadwa explains why Yemen’s role in supporting the Palestinians is truly impressive and remarkable.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺"Out of every 10 words from the West, 15 are lies."
Nicola Hadwa exposes Western media’s demonization of Yemen, highlighting the nation’s resilience as a symbol of anti-imperial resistance.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺Yemen, though poor and besieged, embodies defiant solidarity, transforming its suffering into a force for resistance against oppression.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺 Yemen does not give up
From Yemen, in a show of solidarity with the Palestinian cause, ships associated with the Zionist entity and imperialism are being targeted, disrupting the transfer of goods and products that would support the Israeli regime and its trade.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺"Cuba will not give up"
Carmen Esquivel emphasizes that Cuba remains steadfast in defending its sovereignty against external challenges.
Watch in full
#BlackAndWhite
@PresstvPrograms
🔺According to Carmen Esquivel, Cuba must strengthen ideology, media, and social unity to protect its socialist revolution.
Watch in full
#BlackAndWhite
@PresstvPrograms