Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用py2neo创建节点时出错:关键字can';这不是一种表达_Python_Python 3.x_Neo4j_Py2neo_Property Graph - Fatal编程技术网

Python 使用py2neo创建节点时出错:关键字can';这不是一种表达

Python 使用py2neo创建节点时出错:关键字can';这不是一种表达,python,python-3.x,neo4j,py2neo,property-graph,Python,Python 3.x,Neo4j,Py2neo,Property Graph,我得到一个错误: Vithal=节点(“项目”,名称=l[l.索引(项目)],hasage[l.索引(项目)]=年龄[l.索引(项目)]) SyntaxError:关键字不能是表达式 我正在尝试使用预定义列表中的值为节点创建属性名。正如错误消息所示,关键字不能是表达式。事实上,hasage[l.index(item)]没有任何意义。它是一个“布尔”属性吗?不,它不是一个“布尔”属性。@句子那么,它是什么?正如错误消息所示,关键字不能是表达式。事实上,hasage[l.index(item)]没有

我得到一个错误:

Vithal=节点(“项目”,名称=l[l.索引(项目)],hasage[l.索引(项目)]=年龄[l.索引(项目)])

SyntaxError:关键字不能是表达式


我正在尝试使用预定义列表中的值为节点创建属性名。

正如错误消息所示,关键字不能是表达式。事实上,
hasage[l.index(item)]
没有任何意义。它是一个“布尔”属性吗?不,它不是一个“布尔”属性。@句子那么,它是什么?正如错误消息所示,关键字不能是表达式。事实上,
hasage[l.index(item)]
没有任何意义。它是“布尔”属性吗?不,它不是“布尔”属性。@句子那么,它是什么?
from py2neo import Graph, Node, Relationship
l=["Vipul", "Vithal", "Yoga"]
hasage=["hasAge", "hasAge", "hasAge"]
age=[24,31,26]

g = Graph(password="Abc123")

tx = g.begin()
for item in l:
    Vithal = Node("item", name=l[l.index(item)], hasage[l.index(item)]=age[l.index(item)])
    tx.create(Vithal)
    tx.commit()