Что-то вы гоните насчет "привычного вида формата 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
A study of 1,160 men found that nose size can predict penis size. Larger noses were linked to longer penises. Penis length was also related to lower BMI. Penis circumference was linked to body weight and testicle size. Height, weight, foot size, and testosterone were measured, but nose size and BMI were key for length.
This study supports the old myth about nose and penis size.
👃📏🍌🤏
[Read more]
@googlefactss#Science#BodyFacts#MythConfirmed
The lunula is the white, crescent-shaped part at the base of your fingernail. It shows where new nail cells grow.
💅🌙
@googlefactss
#Lunula#Nails#BodyFacts
The glabella is the smooth area of skin between your eyebrows and above your nose. It helps show facial expressions like frowning.
👁️🗨️🙂
@googlefactss
#Glabella#Face#BodyFacts
The axilla is the medical term for your armpit—the area under your shoulder where your arm connects to your body. It contains lymph nodes, sweat glands, and important blood vessels and nerves.
🦴💪
@googlefactss
#Axilla#Armpit#BodyFacts
The canthus is the corner where your upper and lower eyelids meet, near your eye's edge. It helps protect your eyes and drain tears.
👁️💧
[Read more]
@googlefactss
#Canthus#Eye#BodyFacts
Double body fact today:
●The gnathion is the lowest point on the front of your chin, right in the middle. It’s often used as a reference point in anatomy and facial measurements.
●The zygion is the most lateral point of the zygomatic arch (cheekbone) on your face. It’s often used in anthropology and facial measurements to assess facial width.
😊📏
[Source picture]
@googlefactss
#Zygion#FacialAnatomy#Anthropology
#Gnathion#Chin#BodyFacts