资源简介
非常方便对xml文档进行操作,读取,写入,创建,打开等操作,非常强大。亲测可用。
代码片段和文件信息
# Python program to set the version.
##############################################
import re
import sys
import optparse
def fileProcess( name lineFunction ):
filestream = open( name ‘r‘ )
if filestream.closed:
print( “file “ + name + “ not open.“ )
return
output = ““
print( “--- Processing “ + name + “ ---------“ )
while 1:
line = filestream.readline()
if not line: break
output += lineFunction( line )
filestream.close()
if not output: return # basic error checking
print( “Writing file “ + name )
filestream = open( name “w“ );
filestream.write( output );
filestream.close()
def echoInput( line ):
return line
parser = optparse.OptionParser( “usage: %prog major minor build“ )
(options args) = parser.parse_args()
if len(args) != 3:
parser.error( “incorrect number of arguments“ );
major = args[0]
minor = args[1]
build = args[2]
versionStr = major + “.“ + minor + “.“ + build
print (“Setting doxtinyxml2.h“)
print (“Version: “ + major + “.“ + minor + “.“ + build)
#### Write the tinyxml.h ####
def engineRule( line ):
matchMajor = “static const int TIxml2_MAJOR_VERSION“
matchMinor = “static const int TIxml2_MINOR_VERSION“
matchBuild = “static const int TIxml2_PATCH_VERSION“
if line[0:len(matchMajor)] == matchMajor:
print( “1)tinyxml2.h Major found“ )
return matchMajor + “ = “ + major + “;\n“
elif line[0:len(matchMinor)] == matchMinor:
print( “2)tinyxml2.h Minor found“ )
return matchMinor + “ = “ + minor + “;\n“
elif line[0:len(matchBuild)] == matchBuild:
print( “3)tinyxml2.h Build found“ )
return matchBuild + “ = “ + build + “;\n“
else:
return line;
fileProcess( “tinyxml2.h“ engineRule )
def macroVersionRule( line ):
matchMajor = “#define TINYxml2_MAJOR_VERSION“
matchMinor = “#define TINYxml2_MINOR_VERSION“
matchBuild = “#define TINYxml2_PATCH_VERSION“
if line[0:len(matchMajor)] == matchMajor:
print( “1)macro Major found“ )
return matchMajor + “ “ + major + “\n“
elif line[0:len(matchMinor)] == matchMinor:
print( “2)macro Minor found“ )
return matchMinor + “ “ + minor + “\n“
elif line[0:len(matchBuild)] == matchBuild:
print( “3)macro Build found“ )
return matchBuild + “ “ + build + “\n“
else:
return line;
fileProcess(“tinyxml2.h“ macroVersionRule)
#### Write the dox ####
def doxRule( line ):
match = “PROJECT_NUMBER“
if line[0:len( match )] == match:
print( “dox project found“ )
return “PROJECT_NUMBER = “ + major + “.“ + minor + “.“ + build + “\n“
else:
return line;
fileProcess( “dox“ doxRule )
#### Write the CMakeLists.txt ####
def cmakeRule1( line ):
matchVersion = “set(GENERIC_LIB_VERSION“
if line[0:len(matchVersion)] == matchVersion:
print( “1)tinyxml2.h Major found“ )
return matchVersion + “ \““ + major + “.“ + minor + “.“ + build + “\“)“ + “\n“
else:
return line;
fileProcess( “CMakeLists.txt“ cmakeRule
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-18 01:19 tinyxm
文件 231 2019-03-18 01:19 tinyxm
文件 126 2019-03-18 01:19 tinyxm
文件 4782 2019-03-18 01:19 tinyxm
文件 125 2019-03-18 01:19 tinyxm
文件 808 2019-03-18 01:19 tinyxm
文件 1960 2019-03-18 01:19 tinyxm
文件 214977 2019-03-18 01:19 tinyxm
文件 279 2019-03-18 01:19 tinyxm
文件 93 2019-03-18 01:19 tinyxm
文件 1034 2019-03-18 01:19 tinyxm
目录 0 2019-03-18 01:19 tinyxm
文件 3703 2019-03-18 01:19 tinyxm
目录 0 2019-03-18 01:19 tinyxm
文件 3277 2019-03-18 01:19 tinyxm
文件 3445 2019-03-18 01:19 tinyxm
文件 6059 2019-03-18 01:19 tinyxm
文件 5311 2019-03-18 01:19 tinyxm
文件 6610 2019-03-18 01:19 tinyxm
文件 676 2019-03-18 01:19 tinyxm
文件 147 2019-03-18 01:19 tinyxm
文件 4600 2019-03-18 01:19 tinyxm
文件 9852 2019-03-18 01:19 tinyxm
文件 19419 2019-03-18 01:19 tinyxm
文件 13044 2019-03-18 01:19 tinyxm
文件 31795 2019-03-18 01:19 tinyxm
文件 650 2019-03-18 01:19 tinyxm
文件 3105 2019-03-18 01:19 tinyxm
文件 3712 2019-03-18 01:19 tinyxm
文件 13112 2019-03-18 01:19 tinyxm
文件 32165 2019-03-18 01:19 tinyxm
............此处省略185个文件信息
- 上一篇:nginx-1.8.1.tar.gz
- 下一篇:AD库文件元件库 封装库 3D模型
相关资源
- AD库文件元件库 封装库 3D模型
- nginx-1.8.1.tar.gz
- 利用dmp读取mpu6050四元数和pitch,roll,
- tensorflow 五种花朵分类识别
- deap数据集.pdf
- STC12C5A60S2_AD转换12864显示程序
- Arduino全地形小车代码
- Hibernate_Struts2_学生选课系统完整版系
- 基于Struts2+JDBC+DAO,设计一个简单的网
- cdh5.12.1安装详细过程
- ExcelToMARC marc数据转换
- labview官方链接
- Hadoop与Spark安装配置手册
- 全国空气质量实时检测及预警
- 基于FPGA的音频输出
- labview带通滤波
- GA_SVM.zip
- KF_Altitude
- Package+Control
- AdaBoost特征降维
- mhaghighat-Generalized_Discriminant_Analysis
- SPI.rar
- 基于AT89C51单片机的智能脉搏测试仪设
- netica操作指南中文
- 坏蛋微信解封1.6.1.rar
- Gabor小波+PCA+LDA特征提取方法的人脸表
- 51单片机驱动K型热电偶数字转换器M
- VGGnet_fast_rcnn_iter_70000.ckpt
- UML网上租房系统
- 使用Fragstats 3.3计算景观格局指数的详
评论
共有 条评论