python 删除字符串中连续多个空格并保留一个的方法
作者:AI百科 时间:2021-08-16 14:07:25
如下所示:
' '.join(line.split())
例如:'line dd',运行line.split()得到只有两个元素的列表['line','dd']
来源:https://blog.csdn.net/LUFANGBO/article/details/79308359
标签:python,字符串,空格
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python基于OpenCV实现人脸检测并保存
2023-10-07 00:43:37
python 迭代器和iter()函数详解及实例
2022-03-24 17:55:33
在JavaScript中,为什么要尽可能使用局部变量?
2009-03-01 12:38:00
![](https://img.aspxhome.com/file/UploadPic/20093/1/variable_write_performance2-17s.png)
为您解读CSS优先级
2009-06-18 18:29:00
![](https://img.aspxhome.com/file/UploadPic/20096/18/01-66s.gif)
从trim原型函数看js正则表达式的性能
2008-12-11 13:55:00
QML使用Python的函数过程解析
2021-12-10 19:20:31
python opencv 图像拼接的实现方法
2021-06-21 19:11:51
![](https://img.aspxhome.com/file/2023/3/67933_0s.jpg)
python爬虫要用到的库总结
2021-04-16 23:55:40
python字符串连接方法分析
2021-12-24 16:27:10
Python序列的推导式实现代码
2022-04-24 05:53:46
![](https://img.aspxhome.com/file/2023/0/70650_0s.png)
javascript 模拟函数指针
2009-09-19 18:02:00
Python 恐龙跑跑小游戏实现流程
2021-10-23 19:42:59
![](https://img.aspxhome.com/file/2023/9/66889_0s.png)
Python连接mysql数据库及简单增删改查操作示例代码
2022-03-10 18:01:57
![](https://img.aspxhome.com/file/2023/8/66908_0s.png)
在asp中使用存储过程
2008-02-26 12:17:00
Python深度学习神经网络残差块
2021-05-27 03:41:24
![](https://img.aspxhome.com/file/2023/6/69616_0s.png)
Python实现微信翻译机器人的方法
2022-11-27 08:35:21
![](https://img.aspxhome.com/file/2023/7/64337_0s.jpg)
Django MTV和MVC的区别详解
2023-06-08 10:15:19
![](https://img.aspxhome.com/file/2023/0/75140_0s.png)
js动态显示当前日期,时间和星期代码
2007-08-14 12:31:00
Python常用Web框架Django、Flask与Tornado介绍
2021-06-24 18:19:35
PHP基于cookie与session统计网站访问量并输出显示的方法
2023-11-15 08:38:52