gpt4 book ai didi

python - 如何解析txt中保存的suds对象?

转载 作者:太空宇宙 更新时间:2023-11-03 14:27:21 26 4
gpt4 key购买 nike

我正在与 Web of Science Python client 合作它适用于 SOAP 水,我几乎找不到任何有用的文档。我已经下载了超过 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?

最佳答案

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

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

关于python - 如何解析txt中保存的suds对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47540354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com