python - 如何防止python中的字符引用?
问题描述
如何阻止'"'变成'"' 下面的代码?
>>> from xml.dom.minidom import Document
>>> doc=Document()
>>> name_element = doc.createElement('name')
>>> name_text = doc.createTextNode('"tom"')
>>> name_element.appendChild(name_text)
<DOM Text node "'"tom"'">
>>> name_element.toxml()
'<name>"tom"</name>'
解决方案
推荐阅读
- php - 如何在 laravel 中获得正确的值?
- java - Ubuntu Minecraft 服务器 java.lang.ClassCastException: 类 jdk.internal.loader.ClassLoaders$AppClassLoader
- sql - django中的sql语法
- html - 使用引导程序 4 转换缩放边框悬停 css
- css - CSS无法更改chrome和bootstrap中的输入文本背景颜色
- python - 打印“A”、“B”和“C”的概率是多少(以小数表示)?
- php - 浏览器同步未打开 index.php(使用 Gulp)
- reactjs - 打字稿错误,我无法将函数分配给 RefObject.current 并且它说它不可调用
- firebase - Kotlin searchView 不会重新加载 Firebase 数组
- selenium-webdriver - 使用 wdio-cli/ 为 React Native 实现 resetApp 的方法?- 网络驱动程序