可我浪费着我寒冷的年华

re.S、 re.M

re.S是代表.可以匹配\n以及“  re.M是多行
 
code
import re
a = '''asdfsafhellopass:
    234455
    worldafdsf
    '''
b = re.findall('hello(.*?)world',a)
c = re.findall('hello(.*?)world',a,re.S | re.M)
print 'b is ' , b
print 'c is ' , c

 

打印结果

b is []
c is ['pass:\n 234455"\n aaa\n aawaw\n ']

posted @ 2018-01-15 23:58  珍惜少年时  阅读(1166)  评论(0编辑  收藏  举报
可我浪费着我寒冷的年华