TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #281 · 18 авг.

Что-то вы гоните насчет "привычного вида формата 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

Резултати

Пронајдени 1 слични објави

Пребарај: #bricsoutreach

当前筛选 #bricsoutreach清除筛选

🇷🇺🇲🇳 President of Russia Vladimir Putin and President of Mongolia Ukhnaagiin Khurelsukh held a meeting in Ulaanbaatar. 💬President Putin: First of all, I want to thank you for the invitation. It has, in fact, become a good tradition for us to meet in Mongolia every five years to mark the remarkable highly significant events in our shared history. You have listed the dates we will be commemorating this year. Each of these dates holds special significance for both Russia and Mongolia. I would like to add that Erdenet, which you have mentioned, was planned by architects from Leningrad. I am also pleased to note that the Russian-Mongolian relations have been developing on a new foundation. Our countries have experienced growth in trade, despite the various challenges we have faced, including those you have mentioned, such as COVID. In fact, relations between our countries are progressing well across all areas. Apart from the economy and politics, where we continue to cooperate quite actively, I would like to highlight the successful collaboration in culture and education. The Intergovernmental Commission has been working proactively and there are good results. During our discussions today, we will undoubtedly touch upon the key trends in our economic collaboration. To conclude my opening remarks, I would like to extend an invitation for you to visit Kazan, Russia, where the #BRICS Summit will be held later this year. This will be the first top-level event following the recent expansion of the association. I hope you will take part in the #BRICSOutreach – #BRICSplus format. We look forward to seeing you in Russia. International consultations began with a conversation between the two Leaders in a restricted format, followed by a meeting with the participation of the two countries’ delegations. ✍️ A set of documents was signed following talks. The Government of the Russian Federation and the Government of Mongolia signed agreements on the development of basic project documentation for the reconstruction of the TPP-3 thermal power plant in Ulaanbaatar, as well as on cooperation in the supply of oil products and on providing Mongolia with aviation fuel. The Russian Federal Service for the Oversight of Consumer Protection and Welfare and the Ministry of Health of Mongolia signed an Agreement on cooperation to ensure epidemiological welfare with regard to plague. In addition, the Russian Federation Ministry of Natural Resources and Environment and the Ministry of Environment and Climate Change of Mongolia signed a Memorandum of Understanding on cooperation in the conservation of Lake Baikal and the Selenga River. Presidents Vladimir Putin and Ukhnaagiin Khurelsukh also made statements to the media. #RussiaMongolia