import re
m = re.match('abc','abcd')
if m is not None:
print m.group()
print re.split(',','a,b,c,d,e,f,g')
abc
['a', 'b', 'c', 'd', 'e', 'f', 'g']
python正则
原创
©著作权归作者所有:来自51CTO博客作者xiangjie256的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:c++ lambda
下一篇:异 常
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
python 正则表 python正则?
一.正则基本概念: 1. \d ——匹配数字; \w ——匹配数字+字母 \b ——匹配单词的便捷 \s ——匹配空格符 [特殊字符] ——匹配特殊字符
python 正则表 字符串 python 正则 -
python 正则遍历 python 正则 \s
在Python的正则表达式中,有一个参数为re.S。它表示“.”(不包含外侧双引号,下同)的作用扩展到整个字符串,包括“\n”。看如下代码:
python 正则遍历 python 正则 正则表达式 字符串 -
python正则 非 python正则判断
正则表达式 (Regular Expression)RegEx或正则表达式是形成搜索模式的一个字符序列。
python正则 非 正则表达式 python 人工智能 字符串