functions.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:shakecast 作者: usgs 项目源码 文件源码
def determine_xml(xml_file=''):
    '''
    Determine what type of XML file this is; facility, group, 
    user, master, or unknown
    '''
    tree = ET.parse(xml_file)
    root = tree.getroot()

    xml_type = ''
    if 'FacilityTable' in str(root):
        xml_type = 'facility'
    elif 'GroupTable' in str(root):
        xml_type = 'group'
    elif 'UserTable' in str(root):
        xml_type = 'user'
    elif 'Inventory' in str(root):
        xml_type = 'master'
    else:
        xml_type = 'unknown'

    return xml_type
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号