📜  从字符串中去除 unicode 字符 python 代码示例

📅  最后修改于: 2022-03-11 14:46:09.877000             🧑  作者: Mango

代码示例1
def strip_non_ascii(string):
    ''' Returns the string without non ASCII characters'''
    stripped = (c for c in string if 0 < ord(c) < 127)
    return ''.join(stripped)


test = u'éáé123456tgreáé@€'
print test
print strip_non_ascii(test)