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://www.codercto.com/courses/l/10.html

查看所有标签

Software Engineering for Internet Applications

Software Engineering for Internet Applications

Eve Andersson、Philip Greenspun、Andrew Grumet / The MIT Press / 2006-03-06 / USD 35.00

After completing this self-contained course on server-based Internet applications software, students who start with only the knowledge of how to write and debug a computer program will have learned ho......一起来看看 《Software Engineering for Internet Applications》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

SHA 加密
SHA 加密

SHA 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器