Что-то вы гоните насчет "привычного вида формата 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
Vladimir Vladimirovich Putin congratulated all Russian women on March 8th🌷.
"Dear women, you truly have everything within your power. You know how to create and build, combine strength and tenderness, and your desire to create a better future for your children inspires all of us to move forward,” the president emphasized.
Source: rt_russian
#holidays
🟠RCR | Support | Boost
Happy May 1st, Russian learners! ☀️
In Russia, we say:
• Мир! Труд! Май!
Peace! Labour! May!
But for you, let's change it a little:
• Май! Учёба! Русский!
May! Studying! Russian!
No work today. Just spring, rest, and one small verb conjugation. Maybe two. No pressure.
С праздником! ✨
Natalie with 🤍💙❤️
#holidays
🟠RCR | Support | Boost
🥳Today we celebrate:
• День женской дружбы
International Women's Friendship Day
Don't forget to congratulate your female friends!💋
#holidays
🟠RCR | Support | Boost
🥳Today we celebrate:
• День запрета на уныние!
No Moping Day! Cheerfulness Only Day!
🖼In the Russian Orthodox Church, moping or despondency is considered a major sin.
• Унывать (imperf.)
[oo-ny-vat']
Тo mope, to be despondent, to lose heart
Let's remember today's mantra! And NO moping! 💪
#holidays
🟠RCR | Support | Boost
Vladimir Vladimirovich Putin congratulated all Russian women on March 8th🌷.
"Dear women, you truly have everything within your power. You know how to create and build, combine strength and tenderness, and your desire to create a better future for your children inspires all of us to move forward,” the president emphasized.
Source: rt_russian
#holidays
🟠RCR | Support | Boost
Happy Wide Maslenitsa!
🔻Today marks the start of Широкая Масленица (Wide Maslenitsa) — the final and most festive part of this beloved Slavic holiday!
🔻Forget your diets this week. It's time for:
🥞 Endless piles of blini (pancakes)
☀️ Welcoming the spring sun
🔥 Burning the winter effigy
🥂 Being with family and friends
The Maslenitsa spirit in three words: eat, laugh, repeat!
🔻Whether you're enjoying blini with caviar, sour cream, jam, or just melted butter — may your week be delicious and your spring be bright!
С праздником!
RCRussian with 💓
#holidays
🥳Today we celebrate:
• День ответов на вопросы вашей кошки
Answer Your Cat's Questions Day
🔻On this important day, humans attempt to decipher what's really on their feline friend's mind, all in the pursuit of a better life for their whiskered overlord.
😉For example, your cat might be wondering:
👍Почему кормишь одной и той же едой?
Why do you feed me the same food every day?
🔸Почему не выпускаешь на улицу?
Why don't you allow me into the street?
🔸Почему нельзя драть диван?
Why is it not allowed to scratch the sofa?
🔸Где мои бубенчики?
Where are my balls/bells?
❗️What burning questions do you think your fluffy companion would ask you in Russian?
#holidays
🟠RCR | Support | Boost
🥳Today we celebrate:
• Международный День 'Спасибо'
International Thank You Day!
A simple word can mean everything.❤️
🔻Спасибо!
#holidays
🟠RCR | Support | Boost
Это всё мандарины!
It's all because of the tangerines!
🥳Today we celebrate:
• Международный Разгрузочный День
International Fasting Day
Ну вы поняли:)
🖼It's common for Russian to use 'e' instead of 'ё', as it often is clear for us what is meant.
#holidays
🟠RCR | Support | Boost