Что-то вы гоните насчет "привычного вида формата 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
#ComingSoon: An integrated development at Yew Tee which will house 2-room Flexi flats for seniors, a community club, a polyclinic, retail shops, and Choa Chu Kang’s first hawker centre all under one roof!
P.S. The 2-room Flexi flats will be launched in the upcoming November sales exercise, along with over 4,000 flats in Hougang, Jurong West, Kallang/Whampoa and Tengah 😊
(Photo credit: MKPL Architects)
🚨The SingSing Tycoon NFT Marketplace is on its way🚨
💥 Trade exclusive NFTs for profits.
💎 Flex your collection.
🎮 Unlock game-changing assets.
Get ready to take your SingSing Tycoon experience to the next level! 🚀
🔜 Your favorite NFTs, all in one place—stay tuned for more details 👀
#NFT#SingSingMarketplace#ComingSoon
🎤Announcement | Chat | X (Twitter) | Website | Game
🚀 Big News Alert 🚀
$SING is gearing up for an exciting CEX listing next week! 📈 But we’re keeping the exchange a secret…for now! 🤫
Guess the CEX & get ready for the reveal! 🔥
#SingSing#CEXListing#ComingSoon
🎤Announcement | Chat | X (Twitter) | Website | Game
Kaptaan | Official Teaser | Amazon MX Player
Language: Hindi
Genre: Drama, Crime, Thriller
jahan insaaf ki zarurat ho, wahan Kaptaan ki entry pakki hai ⚖️🔥
Kaptaan, coming soon, only on Amazon MX Player for FREE!
watch now🔗- https://youtu.be/X4Kb6K7B61o
#Kaptaan#AmazonMXPlayer#ComingSoon
Famously Fit with Sophie | Official Trailer | Amazon MX Player
Language: Hindi
Genre : Fitness based Chat Show
Bollywood fitness secrets, finally out 👀
Famously Fit with Sophie, coming soon only on Amazon MX Player for FREE!
watch now - https://youtu.be/Cs6lCuRgBC8
#AmazonMXPlayer#ComingSoon#FamouslyFitwithSophie
🔜 Exciting partnership announcement coming soon! 🎉
Can you guess who will be integrating SingSing's SocialFi SDK next? 🤔
Stay tuned for the big reveal! 🚀✨
#Partnership#SocialFi#SingSing#ComingSoon
📢CLOSED BETA WHITELIST CLOSED
Attention, QuasarK Community: the application period for our closed beta is now officially closed. We want to express our heartfelt thanks ❤️ to everyone who applied and showed their interest in being a part of this exclusive testing phase. Your support and enthusiasm mean the world to us! 👏
🚀 But hold on tight, because the journey is just getting started! In a matter of days we’ll be reaching out to our whitelisted beta testers🏆. If you made it to the whitelist, keep an eye on your notifications and direct messages 📩 as we will be sharing important updates and instructions with you. BEWARE OF SCAM!
Stay tuned for more updates and announcements 👀 as we continue to make progress towards the launch of QuasarK. We appreciate your ongoing support and look forward to embarking on this exciting journey together!
#QuasarK#ClosedBeta#BetaTesters#ComingSoon