#如何使生成器函數來用元組返回壹個字符串大寫字母個數和小寫字母個數
def getUorL(s):
# [A-Z]是匹配內容,str是待匹配的對象 rtn = f"大寫字母個數: {len(re.findall('[A-Z]',s))}" yield rtn # [a-z]是匹配內容,str_是待匹配的對象 rtn = f"小寫字母個數: {len(re.findall('[a-z]',s))}" yield rtnstr = "10ABC23sD~45ffe67e;oo++"
#第壹次返回大寫
g = getUorL(str)
print(next(g))
#第二次返回小寫
print(next(g))