下一节:Python 简介 Python 字符串 swapcase() 方法 Python 字符串方法实例将小写字母大写,大写字母小写: txt = "Hello My Name Is Elon" x = txt.swapcase() print(x) 运行实例定义和用法swapcase() 方法返回一个字符串,其中所有大写字母均成为小写字母,反之亦然。语法string.swapcase()参数值无参数.Python 字符串方法 下一节:Python 简介