Redland python 绑定。意外的打印三元组
我在 python 中有以下代码:
import RDF
parser = RDF.Parser()
model=RDF.Model()
stream=parser.parse_into_model(model,"file:./zoo/zoo.rdf")
list = []
for triple in model:
print triple.subject, triple.predicate, triple.object
list.append([ triple.subject , triple.predicate , triple.object ] )
print len(list)
for k in list:
print k
在第一个循环中,我的 rdf 语句被正确打印。但是在第二个语句中,每个元素的地址被打印出来:
< RDF.Node object at 0x7eec158c>, < RDF.Node object at 0x7eec1b2c>, < RDF.Node object at
0x7eec1b8c>
< RDF.Node object at 0x7eec146c>, < RDF.Node object at 0x7eec606c>, < RDF.Node object at 0x7eec612c>
。 。 。
为什么会发生这种情况而不是打印报表?
I have the below code in python:
import RDF
parser = RDF.Parser()
model=RDF.Model()
stream=parser.parse_into_model(model,"file:./zoo/zoo.rdf")
list = []
for triple in model:
print triple.subject, triple.predicate, triple.object
list.append([ triple.subject , triple.predicate , triple.object ] )
print len(list)
for k in list:
print k
at the first loop the statements of my rdf are printed correctly.But at the 2nd statement the addresses of each element is printed out:
< RDF.Node object at 0x7eec158c>, < RDF.Node object at 0x7eec1b2c>, < RDF.Node object at
0x7eec1b8c>
< RDF.Node object at 0x7eec146c>, < RDF.Node object at 0x7eec606c>, < RDF.Node object at 0x7eec612c>
.
.
.
Why this is happened instead of printing the statements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试
Try
尝试
Try