关于python删除字符串大写字母的代码(可能不是完美的解决方案)
第一种: 遍历删除
text = "AAAbbbbCCCddd"
text_list = [x for x in text]
i = 0
while i<len(text_list):
if text_list[i] == text_list[i].upper():
text_list.remove(text_list[i])
i -= 1
i += 1
after_text = ''.join(x for x in text_list)
第二种:replace方法
import string
text = "AAAbbbbCCCddd"
for uppcase in string.ascii_uppercase:
text = text.replace(uppcase, '')
print(text)