【问题标题】:How to parse suds object saved in txt?如何解析保存在 txt 中的 suds 对象?
【发布时间】:2017-11-28 20:27:19
【问题描述】:

我正在使用Web of Science Python client,它适用于 suds,我几乎找不到任何有用的文档。我已经下载了超过 18k 的搜索结果(由于 API 的限制,这需要几个小时)并保存到文本文件中。现在我想解析它们。

要解析的示例文件:

(searchResults){
   queryId = "462"
   recordsFound = 1
   recordsSearched = 65470148
   records[] = 
      (liteRecord){
         uid = "WOS:000353665400007"
         title[] = 
            (labelValuesPair){
               label = "Title"
               value[] = 
                  "A New Perspective on Instantiation",
            },
         doctype[] = 
            (labelValuesPair){
               label = "Doctype"
               value[] = 
                  "Article",
            },
         source[] = 
            (labelValuesPair){
               label = "Issue"
               value[] = 
                  "3",
            },
            (labelValuesPair){
               label = "Pages"
               value[] = 
                  "448-463",
            },
            (labelValuesPair){
               label = "Published.BiblioDate"
               value[] = 
                  "WIN",
            },
            (labelValuesPair){
               label = "Published.BiblioYear"
               value[] = 
                  "2015",
            },
            (labelValuesPair){
               label = "SourceTitle"
               value[] = 
                  "LIBRARY TRENDS",
            },
            (labelValuesPair){
               label = "Volume"
               value[] = 
                  "63",
            },
         authors[] = 
            (labelValuesPair){
               label = "Authors"
               value[] = 
                  "Garbacz, Pawel",
            },
         other[] = 
            (labelValuesPair){
               label = "Identifier.Eissn"
               value[] = 
                  "1559-0682",
            },
            (labelValuesPair){
               label = "Identifier.Ids"
               value[] = 
                  "CG9UK",
            },
            (labelValuesPair){
               label = "Identifier.Issn"
               value[] = 
                  "0024-2594",
            },
            (labelValuesPair){
               label = "ResearcherID.Disclaimer"
               value[] = 
                  "ResearcherID data provided by Clarivate Analytics",
            },
      },
 }
  1. 如何将这些文件“解析”回 python?
  2. 如果很难做到 - 如何将 suds 对象保存为 XML/JSON?

【问题讨论】:

  • 您找到解决方案了吗?我正在研究完全相同的问题..

标签: python json xml soap suds


【解决方案1】:

我用另一种方式解决了这个问题。

我刚刚创建了自己的 Web of Science Web 服务客户端,它可以打印出 JSON。你可以在这里找到它:https://github.com/mdziezyc/WoSPythonClient

【讨论】:

    猜你喜欢
    • 2015-07-04
    • 2019-02-24
    • 2015-03-14
    • 1970-01-01
    • 2021-03-20
    • 1970-01-01
    • 1970-01-01
    • 2012-07-25
    • 1970-01-01
    相关资源
    最近更新 更多