qq_34678952
qq_34678952
2017-03-08 03:33
采纳率: 50%
浏览 6.0k

python使用正则表达式提取文本中的中文项

'kong=\'\';var line_points=\'\';var line_runtime=\'\';kresult+="m5aa28c34|m5c626c4a|";\r\nvar m5aa28c34= new Array("169路去程","市区线路","水晶城 05:20-19:15 |长白港湾站 06:15-20:15","无人售票,投币每人次1元,IC卡有效","沈阳安运巴士有限公司","169路车型由XML6102UE52型更换为黄海DD6118S13型客车,线路配车为34台,来源于162路。","EUVSHJDZJUJUWRA","EUVSVSHZJUSDVWR|水晶城|148路@2deb8f03,169路@af7e1089","EUVTAIUZJUSCBEA|水晶城街八家子|148路@2deb8f03,148路@2deb8f03,169路@af7e1089,169路@af7e1089","EUVWAHSZJUSBHHC|水晶城街一汽福达|148路@2deb8f03,148路@2deb8f03,169路@af7e1089,169路@af7e1089","EUVUUGSZJUSAABG|良城美景|107路@9c557848,107路@9c557848,112路@94192360,112路@94192360,133路@d810a85c,133路@d810a85c,168路北线@2e2b17a2,168路南线@d0229eed,168路北线@2e2b17a2,168路南线@d0229eed,169路@af7e1089,169路@af7e1089,218路@8beac754,218路@8beac754,384路@e0499228,384路@e0499228,385路@7a32571f,385路@7a32571f,386路@e3ce166e,386路@e3ce166e","EUVTIBHZJURVWHC|辽宁奥通|107路@9c557848,107路@9c557848,112路@94192360,112路@94192360,133路@d810a85c,133路@d810a85c,168路北线@2e2b17a2,168路南线@d0229eed,168路北线@2e2b17a2,168路南线@d0229eed,169路@af7e1089,169路@af7e1089,218路@8beac754,218路@8bea

想要把中间的车站名称提取出来 例如|水晶城|

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • gengziqiang1
    伪造的时空 2017-03-08 06:44
    已采纳
    #coding:utf-8
    import re
    
    a = u"EUVWAHSZJUSBHHC|水晶城街一汽福达|148路@2deb8f03,148路@2deb8f03,169路@af7e1089,169路@af7e1089"
    b = re.compile(u"\|[\u4e00-\u9fa5]*\|")
    c = b.findall(a)
    for i in  c:
        print i
    
    点赞 评论

相关推荐