【数据处理脚本】字符串

1. 检测一个字符串内是否有中文

# 检测字符串是否含有中文
def is_contain_chinese(check_str):
    for ch in check_str:
        if u'\u4e00' <= ch <= u'\u9fff':
            return True
    return False

 

2. 去除括号内容以及括号

import re            
line = re.sub('\(.*?\)','',line)# 去除括号以及括号内的

 

3. 

posted on 2023-11-10 10:36  MonsterPPPP  阅读(8)  评论(0)    收藏  举报

导航