河南省和城乡建设厅网站首页/seo整站优化吧
目录
1、概述
2、下载链接
3、使用方式
3.1 语言选择
3.2 新建模块
3.3 文本位置
3.4 设置文本选项
3.5 断点调试
4、例程
1、概述
大部分时候,安装完成Python之后,自带的有一个IDE,不甚好用,介绍一个自身在用的非常简单安装以及便捷的工具PyScripter工具,里面也包含了Python的包
2、下载链接
PyScripter安装包内涵Pythonhttps://download.csdn.net/download/weixin_43580890/87533689
3、使用方式
3.1 语言选择
建议使用英文,避免不可预测的错误发生。如下图
3.2 新建模块
新建模块如下图
3.3 文本位置
文件位置是可以另存为的
3.4 设置文本选项
点击出现如下窗口
3.5 断点调试
先打断点,然后可以进行调试,打断点的方式直接点到某一行进行左击就行了,消除断点,再次单击一下就可以。
4、例程
如下例程是如何创建一个xml文件,之后的文章会详细介绍一下如何创建,其实怎么创建在B站上有很多视频的,讲解很详细。如下代码直接Copy进工程运行就行,只是一个简单的创建xml而已。
import xml.etree.ElementTree as ET2
#from xml.dom.ElementTree import Document
from xml.dom.minidom import Document
doc = Document()
root = doc.createElement("root")
doc.appendChild(root)
head = doc.createElement("head")
root.appendChild(head)
text1 = doc.createTextNode("1")
code = doc.createElement("code")
code.appendChild(text1)
head.appendChild(code)
#print doc.toxml()
text2 = doc.createTextNode("2")
Msg = doc.createElement("Msg")
Msg.appendChild(text2)
head.appendChild(Msg)
print doc.toxml()
with open("testq.arxml","w+") as f:f.write(doc.toprettyxml(encoding = "UTF-8").decode("UTF-8"))f.close()
print doc.toxml()