Discuss / Python / 还是不怎么懂啊 先这样些吧

还是不怎么懂啊 先这样些吧

Topic source

渡俊

#1 Created at ... [Delete] [Delete and Lock User]

`import re hh = re.compile(r"(\w{7}@\w{5}.\w{3})|(\w{4}.\w{5}@\w{9}.\w{3})") print(hh.match("someone@gmail.com").group(1)) print(hh.match("bill.gates@microsoft.com").group(2))

fhh = re.compile(r"(\w+.?\w+@\w+.\w+)") print(fhh.match("sfdsfaa@dfafd.com").group()) print(fhh.match("dsfds.sdf@sdfa.com").group())

得到 someone@gmail.com bill.gates@microsoft.com sfdsfaa@dfafd.com dsfds.sdf@sdfa.com 在此插入代码

```


  • 1

Reply