首页 > 编程语言 > 详细

Python---协程---重写多进程

时间:2019-06-24 11:35:22      阅读:95      评论:0      收藏:0      [点我收藏+]

一、

# 匹配一行文字中所有开头的字母
import re

s = ‘i love you but you don\‘t love me‘

# \b\m findall
content = re.findall(r‘\w\b‘, s)
print(content)

# 匹配一行文字中所有数字开头的内容

s1 = ‘i 22love 33you 44but 5you don\‘t66 7love 99me‘
# \d
content = re.findall(r‘\b\d‘, s1)
print(content)

# 匹配 只含数字和字母的行
s2 = ‘i love you \n2222kkkk but \ndfefe23 you dont love \n23243dd‘
content = re.findall(r‘\w+‘, s2, re.M)
print(content)

二、写一个正则表达式,使其能匹配以下字符‘bit‘,‘but‘,‘hat‘,‘hit‘,‘hut‘
#  写一个正则表达式,使其能匹配以下字符‘bit‘,‘but‘,‘hat‘,‘hit‘,‘hut‘
s3 = "‘bit‘, ‘bat‘, ‘but‘, ‘hat‘, ‘hit‘, ‘hut‘"
content = re.findall(r‘...t‘, s3)
print(content)

三、
# 提取电子邮件格式
s4 = """xxxxx@gmail.com xxxx@qq.com baidu.com 999.com jkjk@163.com"""

content = re.findall(r‘\w+@\w+.com‘, s4)
print(content)
四、
# 使用正则提取字符串中的单词
s5 = "i love you not because who 233 of 890sdx not"

content = re.findall(r‘\b[a-zA-Z]+\b‘, s5)
print(content)
五、
# 使用正则提取字符串中的单词
s5 = "i love you not because who 233 of 890sdx not"

#content = re.findall(r‘\b[a-zA-Z]+\b‘, s5)
#print(content)

content = re.match(r‘[a-zA-Z]+\b‘, s5)
content = re.search(r‘^[a-zA-Z+\b]‘, s5)
print(content.group())

六、




Python---协程---重写多进程

原文:https://www.cnblogs.com/niaocaizhou/p/11076098.html

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