print("匹配成功,返回一个Match对象:") print(re.match(r"^\d{3}\-\d{3,8}$", "020-6722053")) print("---") print("匹配失败,返回一个None:") print(re.match(r"^\d{3}\-\d{3,8}$", "020 6722053")) print("---") user_input = input("请输入测试字符串:") if re.match(r"...
Python代码 import re while True: try: s = input() a = re.findall(r'(.{3,}).*\1', s) # 出现超过2次的字串 b1 = re.findall(r'\d', s) # 数字 b2 = re.findall(r'[A-Z]', s) # 大写字母 b3 = re.findall(r'[a-z]', s) # 小写字母 b4 = re.findall(r'[^0-9A-...