Python3 swapcase()方法

Python 3 教程 · 2019-02-06 09:44:39

描述

swapcase() 方法用于对字符串的大小写字母进行转换。

语法

swapcase()方法语法:

str.swapcase();

参数

  • NA。

返回值

返回大小写字母转换后生成的新字符串。

实例

以下实例展示了swapcase()函数的使用方法:

#!/usr/bin/python3

str = "this is string example....wow!!!"
print (str.swapcase())

str = "This Is String Example....WOW!!!"
print (str.swapcase())

以上实例输出结果如下:

THIS IS STRING EXAMPLE....WOW!!!
tHIS iS sTRING eXAMPLE....wow!!!

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

Introduction to Programming in Java

Introduction to Programming in Java

Robert Sedgewick、Kevin Wayne / Addison-Wesley / 2007-7-27 / USD 89.00

By emphasizing the application of computer programming not only in success stories in the software industry but also in familiar scenarios in physical and biological science, engineering, and appli......一起来看看 《Introduction to Programming in Java》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具