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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #214 · 12 фев.

Как правильно проверить атрибуты доступа файла? То есть доступна ли запись в файл или является ли он исполняемым? Для этого в Python есть функция os.access() Проверять так: os.access(path, flag) Функция вернёт bool в зависимости от наличия указанного флага. Всего есть 4 флага проверки: os.F_OK - наличие файла на диске os.R_OK - доступ на чтение os.W_OK - доступ на запись os.X_OK - доступ на исполнение Например, вместо try-except лучше делать так (пример из документации): if os.access("myfile", os.R_OK): with open("myfile") as fp: return fp.read() #basic#libs

Hashtags

Резултати

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

Пребарај: #converisation

当前筛选 #converisation清除筛选
English Speakers

@English_Speakers · Post #5139 · 23.12.2022 г., 16:46

#converisation #Beginner #Daily_life @English_speakers ⚜➖⚜➖⚜➖⚜➖⚜➖ A: I’m going to take a nap. B: You should unplug the phone. A: That’s a good idea. B: Do you want me to wake you in an hour? A: No, thanks. Just let me sleep until I wake up. B: I’ll start dinner at 6:00. A: Okay. I think I’ll be awake by then. B: If not, your nose will wake you up. A: You mean I will smell the food cooking? B: You might even dream about dinner A: I don’t think I’m going to dream about anything. I’m really tired. B: Have a nice nap. Listen and practice 👇