import re text = "123123aoasasdfaisdfs阿瑟东阿瑟东佛阿迪斯发到付撒大沙发" # 查找所有的数字 nums = re.findall(r'\d+', text) print(nums) # 查找所有的单词 words = re.findall(r'[a-zA-Z]+', text) print(words) # 查找所有的汉字 chinese_word = re.findall(r'[\u4e00-\u9fa5]+', text)
# chinese_word = re.findall(r'[\u4e00-\u9fa5]{4, 10}', text)# chinese_word = re.findall(r'[\u4e00-\u9fa5]{10}', text)
print(chinese_word)
来源:https://www.cnblogs.com/ldlx-mars/p/12363262.html