|

楼主 |
发表于 2021-9-16 15:34:13
|
显示全部楼层
str1 = input('输入你要找的字符串:')
length = len(str1)
for i in range(length-4):
if str1[i].islower():
if str1[i-1].isupper() and str1[i-2].isupper() and str1[i-3].isupper() and \
str1[i+1].isupper() and str1[i+2].isupper() and str1[i+3].isupper():
if str1[i+4].isupper() == False and str1[i-4].isupper() == False:
print(str[i],end = '')
我本意是想用简单的来尝试一下 ,前面的会换的
我改成了这样,为啥还是会报错,Traceback (most recent call last):
File "G:\phthon\练习\p20-2.py", line 9, in <module>
print(str[i],end = '')
TypeError: 'type' object is not subscriptable乐意看下原因嘛 |
|