Python工具类

获取python版本
'''
获取python版本
'''


def get_py_version():
    version = sys.version_info
    major = version.major
    minor = version.minor
    micro = version.micro
    currVersion = str(major) + "." + str(minor) + "." + str(micro)
    return currVersion
利用etree.xml修改安卓应用包名:
def updateAppName(key, channelName, decompileDir):
    stringsXml = decompileDir + "\\res\\values\\strings.xml"
    if os.path.exists(stringsXml):
        stringTree = ET.parse(stringsXml)
        root = stringTree.getroot()

        for node in list(root):
            name = node.attrib.get('name')
            if name == key:
                node.text = channelName

        stringTree.write(stringsXml, 'utf-8')

你可能感兴趣的:(Python,python,前端,开发语言)