我想从可以从URL获取的XML中获取元素。你知道吗
我编写了以下代码
import xml.etree.ElementTree as ET
url = 'https://www.sec.gov/Archives/edgar/data/1568219/000156821918000001/primary_doc.xml'
req = ulib.Request(url)
primaryXML = ulib.urlopen(req)
xmlData = primaryXML.read()
content = ET.fromstring(xmlData)
可用的XML是
<edgarSubmission xmlns="http://www.sec.gov/edgar/thirteenffiler" xmlns:com="http://www.sec.gov/edgar/common">
<headerData>
<submissionType>13F-HR</submissionType>
<filerInfo>
<liveTestFlag>LIVE</liveTestFlag>
<flags>
<confirmingCopyFlag>false</confirmingCopyFlag>
<returnCopyFlag>false</returnCopyFlag>
<overrideInternetFlag>false</overrideInternetFlag>
</flags>
<filer>
<credentials>
<cik>0001568219</cik>
<ccc>XXXXXXXX</ccc>
</credentials>
</filer>
<periodOfReport>12-31-2017</periodOfReport>
</filerInfo>
</headerData>
<formData>
<coverPage>
<reportCalendarOrQuarter>12-31-2017</reportCalendarOrQuarter>
<filingManager>
<name>TD Ameritrade Trust Co</name>
<address>
<com:street1>PO BOX 17748</com:street1>
<com:city>DENVER</com:city>
<com:stateOrCountry>CO</com:stateOrCountry>
<com:zipCode>80217-0748</com:zipCode>
</address>
</filingManager>
<reportType>13F HOLDINGS REPORT</reportType>
<form13FFileNumber>028-15163</form13FFileNumber>
<provideInfoForInstruction5>N</provideInfoForInstruction5>
</coverPage>
<signatureBlock>
<name>Erik Hunt</name>
<title>Senior Analyst</title>
<phone>303-294-5311</phone>
<signature>Erik Hunt</signature>
<city>Denver</city>
<stateOrCountry>CO</stateOrCountry>
<signatureDate>02-26-2018</signatureDate>
</signatureBlock>
<summaryPage>
<otherIncludedManagersCount>0</otherIncludedManagersCount>
<tableEntryTotal>20</tableEntryTotal>
<tableValueTotal>268468</tableValueTotal>
<isConfidentialOmitted>false</isConfidentialOmitted>
</summaryPage>
</formData>
</edgarSubmission>
我想得到submissionType的值
当我尝试的时候
content.find("edgarSubmission/headerData/submissionType")
我没有得到任何结果。我要13小时
有人能解释一下我做错了什么吗?你知道吗
试试这个。如果
13F-HR
是获取的唯一要求,那么脚本应该这样做。你知道吗或者
输出:
相关问题 更多 >
编程相关推荐