对工作中遇到的不可见字符的去除,做一个记录
def remove_invisible_chars(s):
"""移除所有不可见字符,除\n外"""
str = ''
for x in s:
if x is not '\n' and not x.isprintable():
str += ''
else:
str += x
return str
对工作中遇到的不可见字符的去除,做一个记录
def remove_invisible_chars(s):
"""移除所有不可见字符,除\n外"""
str = ''
for x in s:
if x is not '\n' and not x.isprintable():
str += ''
else:
str += x
return str