1
40huo 2017-04-01 09:32:25 +08:00
正则?
|
2
z4none 2017-04-01 09:40:25 +08:00 via Android
split
join |
3
LichMscy 2017-04-01 09:45:50 +08:00
m = re.findall('[^\s]+', inputStr, re.S)
n = ''.join(m) |
4
coolair OP import re
pat = re.compile(r'\s+') s = ' \t foo \t bar \t ' print pat.sub('', s) |