python五十六课——正则表达式(常用函数之compile())


2).compile(regex,[flags=0]):返回一个Pattern对象(认为:它内部已经封装了一套regex和flags)

可以再通过Pattern对象继续调用match函数(此时只需要传递一个参数:string即可)

注意:

以上函数中涉及的参数:regex、flags、string和re.match中的参数一样理解

猜你喜欢

转载自www.cnblogs.com/hankleo/p/10503812.html