69pao国产精品视频-久久精品一区二区二三区-精品国产精品亚洲一本大道-99国产综合一区久久

Python swapcase()方法

Python swapcase()方法

Python 字符串Python 字符串

Python swapcase() 方法用于對字符串的大小寫字母進(jìn)行轉(zhuǎn)換。

 

語法

swapcase()方法語法:

str.swapcase();

 

參數(shù)

  • NA。

 

返回值

返回大小寫字母轉(zhuǎn)換后生成的新字符串。

 

實例

以下實例展示了swapcase()函數(shù)的使用方法:

#!/usr/bin/python
 
str = "this is string example....wow/b64/";
print str.swapcase();
 
str = "THIS IS STRING EXAMPLE....WOW/b64/";
print str.swapcase();

以上實例輸出結(jié)果如下:

THIS IS STRING EXAMPLE....WOW/b64/
this is string example....wow/b64/

Python 字符串Python 字符串

下一節(jié):Python title()方法

Python 教程

相關(guān)文章