从文本字符串中删除NEL

时间:2017-08-16 04:13:10

标签: python

我使用了此post中的脚本,该脚本从RTF文件中提取文本。

当我将结果输出到文本文件中时,我在记事本++中查看时会看到很多“NEL”。

如何更换“NEL”?对于“NUL”,我设法使用replace(u'\ x00',u'')

删除它

1 个答案:

答案 0 :(得分:1)

NEL是Newline。它应该是U+0085

如果您的编辑在文本中间的dates = [20150501,20150502] #date1=20150501 #date2=20150502 hour1 = 13 # starting hour for date1 hour2 = 12 # ending hour for date2 hours = [hour1,hour2] q9a = """ MATCH (c:Gate)-[r:GoesTo]->(d:Gate) WHERE (r.date >= {date1} AND r.hour >= {houra}) AND (r.date <={date2} AND r.hour <= {hourb}) RETURN c.name AS FromGate, d.name AS ToGate, sum(r.weight) AS WDegree ORDER BY WDegree DESC """ result = graph.cypher.execute(q9a, date1=dates[0],date2=dates[1], houra=hours[0], hourb=hours[1]) 一行显示所有文字,则NEL(或replace(u'\x85', u'\n')取决于您的系统)。