Что-то вы гоните насчет "привычного вида формата 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
🔥
🔥
🔥#OLIMPIADA
🟢ASOSIY OLIMPIADANING RESPUBLIKA BOSQICHIGA START BERILDI
✅Avval xabar berilganidek,24-martdan boshlab, Asosiy olimpiadaning Respublika bosqichiga start beriladi.
✈️Bugun belgilangan manzillarga ishtirokchilar yetib borishdi. Viloyatimizdan 57 nafar o‘quvchilarimiz mazkur olimpiadada ishtrok etishi kutilmoqda.
🌍🌍🌍🌍🌍🌍
Kanalni yaqinlaringiz bilan ulashing
❤https://t.me/toshkentv_xtb| 🌐Facebook|
🔎Veb-sayt | 🌐Instagram|▶️YouTube
👍@ToshvilmmtbgamurojaatBot
#olimpiada
🔴"Akademik Qori Niyoziy merosi" ilmiy-metodik markazi, Matematika instituti hamda Aniq va ijtimoiy fanlar universiteti hamkorligida maktab Matematika fani oʻqituvchilari uchun mukofot jamgʻarmasi 20 000 000 so'm boʻlgan Qori Niyoziy olimpiadasining 1-bosqichi (saralash) o'tkazildi.Unda 56 va undan yuqori ball to‘plagan barcha (jami 235 kishi) 2-bosqichda qatnashishi mumkin.
Natijalar bilan ushbu havola orqali tanishishingiz mumkin: bu yerda
2-bosqich 5 ta yozma ish (har biri 10 balldan) topshiriqlaridan iborat bo'lib, unda maksimal 50 ball to'plash mumkin.
Eslatma: 2-bosqich natijalarini hisoblashda 1-bosqichda olingan natijalar qo‘shilmaydi!
Olimpiadaning 2-bosqichi Toshkent shahrida 2-noyabr (yakshanba) kuni soat 09:30 da Aniq va ijtimoiy fanlar universitetida o‘tkaziladi. Qatnashuvchilar shaxsni tasdiqlovchi hujjat bilan kelishi talab qilinadi.
📍Aniq va ijtimoiy fanlar universitetining manzili:loc.aifu.uz
D'Angelo Russell actively supported his Lakers teammates. He was especially thrilled with Anthony Davis’s alley-oop dunk following LeBron's assist.
#Olimpiada
👁Subscribe to Main Event | Sport News
Do you remember that Chinese player who is 230 cm tall? He is now an assistant coach for the women's national team.
#Olimpiada
👁Subscribe to Main Event | Sport News
Jason Tatum and Tyrese Haliburton did not play in the first match against the Serbian national team.
Such different reactions! One thinks, "Why am I not playing?" Meanwhile, the other thinks, "I can't believe I'm here."
#Olimpiada
👁Subscribe to Main Event | Sport News
Any American athlete who wins a gold medal in Paris will receive a bonus of $37,500. That’s just enough for LeBron James to buy a couple of bottles of wine.
However, for Hong Kong, winning an Olympic gold medal holds much greater value—$768,000.
#Olimpiada
👁Subscribe to Main Event | Sport News
The first father-son duo in Olympic history. It can confidently be said that they have outpaced LeBron and Bronny. Bravo!
#Olimpiada
👁Subscribe to Main Event | Sport News
Griezmann is the top supporter of the French team at the Olympics. He's spending his vacation at the Games and has already attended rugby, gymnastics, swimming, fencing, and equestrian events.
#Olimpiada
👁Subscribe to Main Event | Sport News
At 229 centimeters tall, Yao Ming looks like a giant compared to the other coaches of the Chinese women's basketball team.
#Olimpiada
👁Subscribe to Main Event | Sport News
French swimmer Marchand won gold in the 400m individual medley, setting a new Olympic record and taking it from Michael Phelps.
#Olimpiada
👁Subscribe to Main Event | Sport News
The unexpected hero of the day at the Olympics: a man in bright swim trunks jumped into the water and retrieved the cap that had fallen off a swimmer from the previous race.
#Olimpiada
👁Subscribe to Main Event | Sport News
The captain of Japan's women's gymnastics team, Seko Miyata, might miss the Olympics because she smoked a week before the Games. The 19-year-old athlete faces exclusion from the team as smoking and purchasing tobacco are illegal in Japan until the age of 20.
#Olimpiada
👁Subscribe to Main Event | Sport News