资源简介
非常方便对xml文档进行操作,读取,写入,创建,打开等操作,非常强大。亲测可用。
![](http://www.nz998.com/pic/53138.jpg)
代码片段和文件信息
# 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模型
相关资源
- 登录注册界面.zip48872
- 电信中兴光猫超密获取工具使用方法
- 条码字体barcode128
- Rational Rose Common破解文件
- res10_300x300_ssd_iter_140000.caffemodel与dep
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- scratch 第1课 翻跟斗的小猫(入门)
- stm32f407上的两个can发送和接收例程
- Scrach 欢乐狙击手.sb2
- Wolfram Mathematica 矩阵初等变换函数(
- 商品查询录入工具(e4a.e4a)
- pscad近海风电模型 Fortran语言
- 程序员专用字体YaHei.Consolas.1.11b42517
- scratch3.0 源程序(说相声)
- AutoCAD永久去教育版破解补丁
- 开源1A锂电池充电板TP4056原理图+PCB
- FPGA实现PID.v
- grads绘制雨量(GRID.GRD)
- DV泵加罗茨泵独立控制系统PID.smart
- Xamarin forms 手势事件
- Scratch 飞机大战.sb3
- 秒杀360加壳.rar
- 一个labview仿真的函数信号发生器.vi
- 基于FPGA的sdi视频传输工程(k7_sdi_rx
- FPGA彩条显示
- 《Visual Prolog 集成开发环境(下)》
- 《Visual Prolog 基础类》 中文参考.chm
- 基于ACCESS的生产管理信息系统.mdb
- CANopen使用手册_埃斯顿
- axure 框架图模板设计.rp
评论
共有 条评论