[問題] 請問如何在regular expression裡面使用中文
大家好
我現在遇到了一個問題是,我寫的re在match英文都很正常,可是中文他一律找不到
不知道有沒有什麼解法
我的檔案是utf-8編碼,開頭有# -*- coding: utf-8 -*-,也有
sys.setdefaultencoding('utf-8')
re.match(r"哈囉|Hello|你好|嗨", message.content, re.UNICODE)
re.match(r"哈囉|Hello|你好|嗨", message.content)
上面這兩種都只能match到message.content是Hello的時候,其他中文都不行。
謝謝。
--
※ 發信站: 批踢踢實業坊(ptt.cc) 
◆ From: 220.133.53.142
→
11/06 15:28, , 1F
11/06 15:28, 1F
→
11/06 15:33, , 2F
11/06 15:33, 2F
→
11/06 16:11, , 3F
11/06 16:11, 3F
→
11/06 21:59, , 4F
11/06 21:59, 4F
→
11/09 20:38, , 5F
11/09 20:38, 5F
Python 近期熱門文章
PTT數位生活區 即時熱門文章