# coding:utf-8
import sys
import csv
import re
import collections as col
#导入的库
from openpyxl import load_workbook
reload(sys)
sys.setdefaultencoding( "utf-8" )
#打开的文件
fp = '/home/hadoop/同义词.xlsx'
ws = load_workbook(fp)
#要读取的工作薄
sheet = ws.get_sheet_by_name("sheet1")
#按行读取
for i in sheet.rows:
a = i[0].value if i[0].value != None else '' #如果单元格的值为空,则空串
b = i[1].value if i[1].value != None else ''
c = i[2].value if i[2].value != None else ''
#构造cypher语句,用于在cypher-shell下执行
print 'match (n :Source) where n.name = ','"'+ a + '" set n += ', '{ synonym: "'+b + '" , ref: "'+c+'"};'