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

Резултати

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

Пребарај: #libxml2

当前筛选 #libxml2清除筛选
AIGC

@aigcrubbish · Post #16 · 25.12.2024 г., 18:34

libxml2 在 2.11.9、2.12.9 和 2.13.3 之前的版本中存在一个安全漏洞,SAX 解析器在自定义 SAX 处理程序尝试通过设置 "checked" 来覆盖实体内容时,仍然会为外部实体生成事件。这使得经典的 XXE(XML 外部实体注入)攻击成为可能。 该漏洞已在后续版本中修复,建议用户尽快升级到最新版本以避免潜在的安全风险。 参考链接: - [GitHub 安全公告](https://github.com/advisories/GHSA-6c2p-rqx3-w4px) - [NVD 漏洞详情](https://nvd.nist.gov/vuln/detail/CVE-2024-40896) - [libxml2 修复提交](https://gitlab.gnome.org/GNOME/libxml2/-/commit/1a8932303969907f6572b1b6aac4081c56adb5c6) - [libxml2 问题报告](https://gitlab.gnome.org/GNOME/libxml2/-/issues/761) #安全漏洞#XXE#libxml2#SAX解析器 #AIGC

djangoproject

@djangoproject · Post #551 · 23.01.2018 г., 16:28

http://lxml.de/ #lxml is the most feature-rich and easy-to-use library for processing #XML and #HTML in the Python language. The lxml XML toolkit is a Pythonic binding for the #C libraries #libxml2 and #libxslt. It is unique in that it combines the speed and XML feature completeness of these libraries with the simplicity of a native Python #API, mostly compatible but superior to the well-known ElementTree API. The latest release works with all #CPython versions from 2.6 to 3.6. See the introduction for more information about background and goals of the lxml project. Some common questions are answered in the FAQ.