|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 jle55555 于 2017-11-24 19:49 编辑
- str2='''小甲鱼老师发的string2文本文档内容粘贴'''
- str2=str2.replace('\n','')
- low='abcdefghijklmnopqrstuvwxyz'
- high='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- lis1=[]
- length=len(str2)
- for i in range(3,length-3):
- if str2[i] in low:
- if (str2[i-1] in high) and (str2[i-2] in high) and (str2[i-3] in high) and (str2[i+1] in high) and (str2[i+2] in high) and (str2[i+3] in high):
- lis1.append(str2[i])
- print(lis1)
复制代码
本帖最后由 ooxx7788 于 2017-11-25 11:55 编辑
- f = open(r'C:\Users\letian\Documents\python\string2.txt')
- f_str = f.read()
- lenth = len(f_str)
- password = []
- for i in range(4, lenth-4):
- pw = f_str[i]
- if pw.islower():
- if f_str[i-4].islower() and f_str[i+4].islower() and f_str[i-3].isupper() \
- and f_str[i-2].isupper() and f_str[i-1].isupper() and f_str[i+1].isupper() \
- and f_str[i+2].isupper() and f_str[i+3].isupper():
- password.append(pw)
- print(''.join(password))
复制代码
这是我学时候写的代码。 主要是要找到符合aAAAaAAAa这种结构中的中间那个a
|
|