File size: 332 Bytes
c6ad667
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import re

def txt_2_list(txt):
  split_token = r'[ ,、,;;《》<>]'
  rm_token = r'["\'”“‘’。.!!?? 【】\[\]]'
    
  arr = re.split(split_token, txt)
  arr = [re.sub(rm_token, '', item) for item in arr if item != '']
  # 从大到小排序
  arr.sort(key=lambda x: len(x), reverse=True)
  return arr