Что-то вы гоните насчет "привычного вида формата 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
#Vocabulary
🕸Dormant
🦦 (of an animal) having normal physical functions suspended or slowed down for a period of time; in or as if in a deep sleep
🫧 Ex:- During the winter months, the bears will often go dormant and hibernate.
🌨Basic Synonyms
🌓 asleep
🌓 slumbering
🌓 inactive
🌟Advanced Synonyms
✨ comatose
✨ supine
✨ lethargic
✨ torpid
✨ aestivating
🌔Antonyms
🍀 awake
🍀 wakeful
#Vocabulary
🎶Repertory2⃣
🎼a collection, especially of music or information
🎻 Ex:- This year, the Boston Philharmonic has expanded its repertory to include compositions from Mexico.
🎸Basic Synonyms
collection
#Vocabulary
🎨Repertory1⃣
🎭 the performance of various plays, operas, or ballets by a company at regular short intervals
Ex:- Martin was overjoyed when he learned his audition was good enough to get him accepted at the New York Repertory for Young Composers.
❄️Basic Synonyms
🫧 theater
🫧 troupe
🫧 school
#Vocabulary
📜 Screed
📝a long speech or piece of writing, typically one regarded as tedious
✍Example:-
When they lost the match, the team coach launched into an almost incoherent screed on all the areas the team had to improve in.
📒Basic Synonyms
🖌 rant
📔Advanced Synonyms
🖍 harangue
#Vocabulary
🥢Palatable
🍽(of food or drink)
pleasant to taste; has acceptable taste
🍴Example:-
Tonight, a surprisingly palatable spread will be laid out on the table. Don't be shy — come.
🧉Basic Synonyms
🥤 tasty
🥤 eatable
🍹Advanced Synonyms
🧋 appetizing
🧋 edible
🧋 savoury
🧋 delectable
🧋 luscious
🧋 flavourful
🧃Antonyms
🫗 distasteful
🫗 unsavoury
#Vocabulary
💡Mellifluous
/məˈlɪflu.əs/, /mɛˈlɪflu.əs/
⚜Sweet or musical; pleasant to hear.
💥Her mellifluous voice captivated the audience during her performance.
#Vocabulary
🔸Cacophony
⚜A harsh, discordant mixture of sounds.
💥 The cacophony of honking cars and
shouting pedestrians filled the streets of the busy city.
#Vocabulary
🌺Diffident.
●Lacking or marked by a lack of self-confidence; shy and timid, distrustful of one's own powers.
●He was diffident about his own success.
●Because she was only a first-year student, she was diffident when offering a comment on the professor's lecture.
#Vocabulary
🌺Spurious
/ˈspjʊəriəs/ 《adjective》
●a spurious statement, argument etc is not based on facts or good thinking and is likely to be incorrect.
▪️He demolished the opposition’s spurious arguments.