You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
451 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from py2neo import Graph, Node
# 使用新版连接协议注意端口改为7687
db = Graph("neo4j://127.0.0.1:7687", auth=("neo4j", "DsideaL4r5t6y7u"))
# 更现代的写法(使用上下文管理器自动提交)
node_1 = Node("英雄", name="张无忌")
node_2 = Node("英雄", name="杨逍", power=100)
node_3 = Node("派别", name="明教")
db.create(node_1 | node_2 | node_3) # 使用 | 运算符组合节点
print(node_1)