python - 如何在 Neo4j python-embedded 中附加一个列表?

标签 python list neo4j

我正在尝试使用这些文档在 Neo4j python 中制作图表: http://docs.neo4j.org/chunked/snapshot/python-embedded-reference-core.html “允许的属性值包括字符串、数字、 bool 值以及这些基元的数组”。因此,我正在尝试构建一个字符串列表,然后附加该列表。

from neo4j import GraphDatabase
db = GraphDatabase('/home/username/Neo4j/')
with db.transaction:
    testNode = db.node()
    testNode['stringList'] = ["one","two"]
    string_list_edit = testNode['stringList']
    string_list_edit.append("three")

给我这个错误:

AttributeError: 'java.lang.String[]' object has no attribute 'append'

这是怎么做到的?

最佳答案

如果您粘贴所有代码,则可以评估它是否存在其他错误。查看文档:http://docs.neo4j.org/chunked/snapshot/python-embedded-reference-core.html

你包括在内吗?

with db.transactions:

在你的代码之前?你必须那样做。另外,试试这个:

testNode['stringList'] = ["one","two"]
string_list_edit = testNode['stringList']
string_list_edit.append("three")
testNode['stringList'] = string_list_edit

关于python - 如何在 Neo4j python-embedded 中附加一个列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10144869/

相关文章:

neo4j - APOC 仅在 neo4j 中部分安装其扩展(一个过程)

java - 无法从 SDN4 检索一组父类(super class)型对象

python - 用于 Bokeh 散点图中多个数据系列的 HoverTool

python - 使用python在postgresql数据库中插入json数据的问题

jquery - 使用 jquery 根据 li 元素对 ul 列表进行排序?

python - 将列表转换为 ID 列表

Python、__init__ 和 self 混淆

java - 如何在java中转换python推断类型 'any'

java - 获取错误消息 "the method asList(string[]) is undefined for the type arrays"

database - 如何在 Neo4j 中删除/创建数据库?