Что-то вы гоните насчет "привычного вида формата 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
⚠️🇺🇸NEXT GENERATION GOP COULD BE MORE EXTREME THAN MAGA — WASHINGTON POST
🔹 Young white nationalists like Nick Fuentes infiltrating mainstream Republican circles 📱
🔹 Groypers movement gaining influence: antisemitic, nativist, racist ideology spreading 🚩
🔹 Iran war could be breaking point that expands their power within the party 🌍
🔹 Pattern repeats: Tea Party was more extreme than Gingrich era, now this generation tops MAGA 📈
🔹 Even Marjorie Taylor Greene broke with Trump over Iran threats as "madness" ⚡
One GOP insider warns: "Trump opened the door for this next generation to take over." The party's rightward spiral shows no signs of stopping! 😬🔥
#Republican#MAGA
@america
October 12, 2021: Texas Governor, San Diego crash, U.S. Navy, Indigenous Peoples' Day, Afghanistan
October 12, 2021: Texas Governor, San Diego crash, U.S. Navy, Indigenous Peoples' Day, Afghanistan
1. Republican Texas Governor Greg Abbott, responding to what he called "bullying" by the Biden Administration, barred all COVID-19 vaccine mandates in the state by any entity, including private employers.
2. A small aircraft crashed blocks from a high school campus near San Diego, killing at least two people and injuring two others, while also destroying homes, officials and local media said.
3. Former U.S. Navy nuclear engineer and his wife are scheduled to face their first court hearing on charges they attempted to sell secrets about nuclear submarines to a foreign power in exchange for cryptocurrency.
4. Christopher Columbus Day drew crowds with U.S. city parades marking the explorer's voyage and Italian-American culture, as the focus increasingly turned to the heritage and plight of indigenous people subjugated by European settlers.
5. Afghanistan's foreign minister appealed to the world for good relations but avoided making firm commitments on girls' education despite international demands to allow all Afghan children to go back to school.
#TexasGovernor
#GregAbbot
#Republican
#Covid19
#Biden
#SanDiego
#Aircraftcrash
#UnitedStates
#Navy
#Cryptocurrency
#ChristopherColumbusDay
#Parades
#Afghanistan
#News
#Reuters
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖