首页 > 其他 > 详细

正则匹配查询字符串中指定内容

时间:2020-09-28 14:51:13      阅读:30      评论:0      收藏:0      [点我收藏+]
import re
def calcultor(content):
    num = len(re.findall([0-9],content))
    alpah = len(re.findall([a-zA-Z],content))
    blank = len(re.findall( ,content))
    others = len(re.findall([^0-9a-zA-Z ],content))
    print(数字:%s , 字母:%s ,空格:%s,其他:%s%(num,alpah,blank,others))
calcultor(a  s****-)
#数字:0 , 字母:2 ,空格:2,其他:5

 

正则匹配查询字符串中指定内容

原文:https://www.cnblogs.com/thanos-ryan/p/13744443.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!