擅长:python、mysql、java
<p>你试过使用<a href="https://github.com/amzn/ion-python" rel="nofollow noreferrer">Amazon Ion</a>库吗</p>
<p>假设问题中提到的数据存在于一个名为“myIonFile.ion”的文件中,并且如果该文件中只有ion对象,我们可以按如下方式从该文件中读取数据:</p>
<pre><code>from amazon.ion import simpleion
file = open("myIonFile.ion", "rb") # opening the file
data = file.read() # getting the bytes for the file
iondata = simpleion.loads(data, single_value=False) # Loading as ion data
print(iondata['PersonId']) # should print "4tPW8xtKSGF5b6JyTihI1U"
</code></pre>
<p>关于使用离子库的进一步指导见<a href="http://amzn.github.io/ion-docs/guides/cookbook.html" rel="nofollow noreferrer">Ion Cookbook</a></p>
<p>此外,我不确定您的用例,但是与QLDB的交互也可以通过<a href="https://github.com/awslabs/amazon-qldb-driver-python" rel="nofollow noreferrer">QLDB Driver</a>完成,它直接依赖于离子库</p>