免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1338 | 回复: 0
打印 上一主题 下一主题

文本内容处理成字典的例子 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-10-26 17:16 |只看该作者 |倒序浏览
有一个文档:
内容大致为:
(reply){
   ExportOrganizationDataResult =
      (ArrayOfPtrOrganization){
         PtrOrganization[] =
            (PtrOrganization){
               OrganizationNO = "00269904"
               OrganizationNameShort = "综合办公室厂处级"
               OrganizationName = "机械分公司综合办公室厂处级"
               SuperiorNo = "00269881"
               OrganizationLevel = "二级单位直属机构内设机构"
               OrganizationLevelCode = "3C"
               RegionCode = "070"
               Region = "1省"
               City = "1市"
               IsEmptyOrg = None
               OrgStartDate = "20161001"
               OrgEndDate = "99991231"
               CreateTime = "2005/10/22 12:47:09"
               LastUpdateTime = "2016/10/12 0:16:59"
            },
            (PtrOrganization){
               OrganizationNO = "00269905"
               OrganizationNameShort = "综合办公室中干"
               OrganizationName = "公司综合办公室中干"
               SuperiorNo = "00269881"
               OrganizationLevel = "二级单位直属机构内设机构"
               OrganizationLevelCode = "3C"
               RegionCode = "070"
               Region = "2省"
               City = "2市"
               IsEmptyOrg = None
               OrgStartDate = "20161001"
               OrgEndDate = "99991231"
               CreateTime = "2005/10/22 12:47:09"
               LastUpdateTime = "2016/10/12 0:16:59"
            },
             (PtrOrganization){
               OrganizationNO = "50095191"
               OrganizationNameShort = "40018队"
               OrganizationName = "西部40018队"
               SuperiorNo = "65118390"
               OrganizationLevel = "三级单位"
               OrganizationLevelCode = "40"
               RegionCode = "550"
               Region = "3省"
               City = "3市"
               IsEmptyOrg = None
               OrgStartDate = "20161001"
               OrgEndDate = "99991231"
               CreateTime = "2005/10/22 12:42:20"
               LastUpdateTime = "2016/10/13 0:16:59"
            },
      }
   isSuccessReceived = "S"
   strErrorDes = None
}

想截取其中PtrOrganization后{}之间的内容,将所有{}中的内容存成字典形式放到一个list中,大致如:[{OrganizationNO:"00269904",OrganizationNameShort :"综合办公室厂处级"},{OrganizationNO: "00269905"},{OrganizationNO:"50095191"}]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP