两点水
This commit is contained in:
19
Code/Python14Code/com/twowater/test2.py
Normal file
19
Code/Python14Code/com/twowater/test2.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
import re
|
||||
|
||||
a = 'uav,ubv,ucv,uwv,uzv,ucv,uov'
|
||||
|
||||
# 字符集
|
||||
|
||||
# 取 u 和 v 中间是 a 或 b 或 c 的字符
|
||||
findall = re.findall('u[abc]v', a)
|
||||
print(findall)
|
||||
# 如果是连续的字母,数字可以使用 - 来代替
|
||||
l = re.findall('u[a-c]v', a)
|
||||
print(l)
|
||||
|
||||
# 取 u 和 v 中间不是 a 或 b 或 c 的字符
|
||||
re_findall = re.findall('u[^abc]v', a)
|
||||
print(re_findall)
|
||||
Reference in New Issue
Block a user