📜  python remove \t - Python 代码示例

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

代码示例1
>>> s="abc \n \t \t\t \t \nefg"
>>> ''.join(s.split())
'abcefg'
>>> ''.join(c for c in s if not c.isspace())
'abcefg'

import re

s = 'abc \n \t \t\t \t \nefg'
re.sub(r'\s', '', s)
=> 'abcefg'