1
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.

sentence
  • 8,213
  • 4
  • 31
  • 40

0 Answers0