比如使用 replace() 方法或者是用正则表达式替换。示例如下:. >>> s.replace(' ', '') 'helloworld' >>> import re >>> re.sub('\s+', ' ', s) 'hello world' >>>.
確定! 回上一頁