python3中英文混合字符串的分離

正好我作的一個項目用到了這個,找了很多資料,多數都不靈光,後來想到一個正則能夠作到。留下筆記。 import re str = "2. Good morning / afternoon / evening! 早晨(下午/晚上)好!" pattern = re.compile(r'(?P<space>\s)') # 匹配空格的正則 match = re.split(pattern, str) a=m
相關文章
相關標籤/搜索