我有一个txt文件,需要找到最小6位数字,大写和小写字母,数字和标点符号。我的错误是什么?
import re
word_list = []
with open('passwords.txt') as f:
for line in f.readlines():
word_list += re.findall(r'^?=.*[A-Z])(?=.*[!@#$&*])(?=.*[0-9])(?=.*[a-z]).{6}', line)
答案 0 :(得分:0)
你可以尝试:
import re
word_list = []
with open('passwords.txt') as f:
for line in f.readlines():
word_list += re.findall(r'[0-9a-zA-Z!@#$%^&*]{6}', line)