面试题答案
一键面试import re
# 使用compile函数编译正则表达式
pattern = re.compile(r'^[a-zA-Z0-9]{6,}$')
strings = ['abc1234', 'xyz', '1234567']
for string in strings:
if pattern.match(string):
print(string)
import re
# 使用compile函数编译正则表达式
pattern = re.compile(r'^[a-zA-Z0-9]{6,}$')
strings = ['abc1234', 'xyz', '1234567']
for string in strings:
if pattern.match(string):
print(string)