python清除字符串里非数字字符的方法
作者:pythoner 时间:2023-08-12 02:47:32
本文实例讲述了python清除字符串里非数字字符的方法。分享给大家供大家参考。具体如下:
import re
s = "how19 a*re 254y**ou?"
# Using regular expressions
print re.sub("\D", "", s)
希望本文所述对大家的Python程序设计有所帮助。
标签:python,清除,字符串
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python优化技巧之利用ctypes提高执行速度
2022-01-26 09:13:04
Python通过30秒就能学会的漂亮短程序代码(过程全解)
2022-08-22 13:54:50
Flask中jinja2的继承实现方法及实例
2022-09-24 12:31:09
Mysql数据库手动及定时备份步骤
2024-01-27 10:43:15
![](https://img.aspxhome.com/file/2023/4/69854_0s.png)
golang如何通过viper读取config.yaml文件
2023-07-22 05:46:11
![](https://img.aspxhome.com/file/2023/5/95365_0s.png)
Python Pandas两个表格内容模糊匹配的实现
2021-09-06 01:56:23
![](https://img.aspxhome.com/file/2023/4/131244_0s.png)
python变量命名的7条建议
2021-05-15 20:16:07
Centos6.x服务器配置jdk+tomcat+mysql环境(jsp+mysql)
2023-06-14 12:14:13
![](https://img.aspxhome.com/file/2023/1/67221_0s.png)
Python基于更相减损术实现求解最大公约数的方法
2022-10-31 16:13:24
![](https://img.aspxhome.com/file/2023/1/118731_0s.png)
Mysql数据库之Binlog日志使用总结(必看篇)
2024-01-20 20:15:16
python实现K折交叉验证
2023-06-08 18:49:01
![](https://img.aspxhome.com/file/2023/2/127012_0s.jpg)
必备 SQL 查询优化技巧提升网站访问速度
2024-01-18 23:59:37
![](https://img.aspxhome.com/file/2023/0/98030_0s.jpg)
Python新建项目自动添加介绍和utf-8编码的方法
2023-02-07 07:58:06
![](https://img.aspxhome.com/file/2023/4/65474_0s.gif)
Python中的元组介绍
2021-04-09 19:56:37
![](https://img.aspxhome.com/file/2023/5/105605_0s.png)
.Net行为型设计模式之访问者模式(Visitor)
2024-05-13 09:18:14
![](https://img.aspxhome.com/file/2023/0/126180_0s.png)
go语言中fallthrough的用法说明
2024-04-23 09:33:47
![](https://img.aspxhome.com/file/2023/6/134416_0s.png)
python中用ggplot绘制画图实例讲解
2023-07-04 07:25:16
![](https://img.aspxhome.com/file/2023/1/77041_0s.jpg)
OpenCV学习记录python实现连通域处理函数
2023-05-01 05:53:24
![](https://img.aspxhome.com/file/2023/9/98819_0s.png)
学生如何免费使用Pycharm专业版学生认证教程
2021-11-20 16:25:13
![](https://img.aspxhome.com/file/2023/7/95587_0s.jpg)
关于Python中的main方法教程
2021-12-30 08:31:37