|
楼主 |
发表于 2020-5-15 12:52:26
|
显示全部楼层
本帖最后由 guardianpeak 于 2020-5-15 13:15 编辑
改了一下,似乎可以了
str2 = '这里是那一串巨长的字符串不再复制了'
str3 = 'AWERTYUIOPQSDFGHJKLZXCVBNM'
for i in str3:
str2 = str2.replace (i, '0')
list1 = []
k = 0
while k < len(str2) - 1:
if str2[k] != '0' and \
str2[k] != '\n' and \
str2[(k - 1)] == '0' and \
str2[(k - 2)] == '0' and \
str2[(k - 3)] == '0' and \
str2[(k - 4)] != '0' and \
str2[(k + 1)] == '0' and \
str2[(k + 2)] == '0' and \
str2[(k + 3)] == '0' and \
str2[(k + 4)] != '0' :
list1.append (str2[k])
k += 1
print(list1)
|
|