Error while creating node using py2neo : keyword can't be an expression

94 Views Asked by At
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()

I'm getting an error:

Vithal = Node("item", name=l[l.index(item)], hasage[l.index(item)]=age[l.index(item)])

SyntaxError: keyword can't be an expression

I'm trying to create a property name for the node with a value from the predefined list.

0

There are 0 best solutions below