This topic created in 3510 days ago, the information mentioned may be changed or developed.
4 replies • 2017-04-01 10:30:34 +08:00
 |
|
正则?
|
 |
|
split join
|
 |
|
m = re.findall('[^\s]+', inputStr, re.S) n = ''.join(m)
|
 |
|
import re pat = re.compile(r'\s+') s = ' \t foo \t bar \t ' print pat.sub('', s)
|