|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- str1 = """XbmSqnpjwJEaDYoehEklEgJyiksGxdEKgfYRXQecRZgfeqKWGc"""
- countA = 0
- countB = 0
- countC = 0
- length = len(str1)
- for i in range(length):
- if str1[i] == "\n":
- continue
- if str1[i].isupper():
- if countB:
- countC += 1
- else:
- countC = 0
- countA += 1
- if str1[i].islower():
- if countA != 3:
- countA = 0
- countB = 0
- countC = 0
- else:
- if countB:
- countA = 0
- countB = 0
- countC = 0
- else:
- countB = 1
- countC = 0
- target = i
- if countA == 3 and countC == 3:
- if i +1 != length and str1[i+1].isupper():
- countB = 0
- countC = 0
- else:
- print(str1[target], end=" ")
- countA = 3
- countB = 0
- countC = 0
复制代码
if i +1 != length and str1[i+1].isupper(): 这句关系判断 前面的 什么意思 没看明白 if i +1 != length #这里 length 是所有字符的和的值? 是这意思么 如果是 那肯定不相等啊
if countA == 3 and countC == 3:
这一句表示前后的大小字母分别是3个
if i +1 != length 这句中的length是整个字符串的长度,这里表示i没有索引到最后一个字符
|
|