Python 正则表达式基础

Python 正则表达式基础

正则表达式基础

正则表达式几乎在每个语言中都有支持,并且其表达式基本都一样。下面列出所有表达式:

python-regex

看看python中的基本的正则表达式的用法:

找出下面字符的head部分:

>> fileStr = "<head>write your title here</head><body>content should be here</body>"

>> import re

>> print re.match( '<head>(.+?)</head>', filStr).group

<head>write your title here</head>

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:

1 thought on “Python 正则表达式基础

  1. Pingback: Python 分析html | 360converter博客360converter博客

Leave a Reply

Your email address will not be published. Required fields are marked *