string.swapcase()
描述
Python swapcase() 方法用于对字符串的大小写字母进行转换。
语法
swapcase()方法语法:
str.swapcase();
w≡╝3≡╝x≡╝u≡╝e.com提供本在线速查手册,请勿盗用!
参数
- NA。
返回值
返回大小写字母转换后生成的新字符串。
实例
以下实例展示了swapcase()函数的使用方法:
#!/usr/bin/python str = "this is string example....wow!!!"; print str.swapcase(); str = "THIS IS STRING EXAMPLE....WOW!!!"; print str.swapcase();
w≡╝3≡╝x≡╝u≡╝e.com提供本在线速查手册,请勿盗用!
以上实例输出结果如下:
this is string example....wow!!!
w≡╝3≡╝x≡╝u≡╝e.com提供本在线速查手册,请勿盗用!