|
|
发表于 2018-3-30 23:12:34
|
显示全部楼层
'''
打印 上一主题 下一主题 求解惑,有些看不懂 [复制链接]
1#
嘻嘻咯咯 发表于 3 分钟前 10 | 只看该作者 回帖奖励
'''
str1 = '''长字符串。。。 '''
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 == 1: #如果第一次能运行这个if语句 count = 0,但是你的代码最多能执行到else就continue重新循环了,因为continue的功能是停止当前循环,然后再重新循环的作用。所以else后面的语句都没有用了。
countC += 1
countA = 0
else:
countA += 1
continue
if str1[i] . islower() and conutA == 3: #这段依然看不懂
conutB = 1
countA = 0
target = i
continue
if str1[i] . islower() and conutC == 3:
print( str1[target], end = ' ')
countA = 0
countB = 0
countC = 0 |
|