Python swapcase()方法

Python 教程 · 2019-02-02 18:43:03

描述

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

语法

swapcase()方法语法:

str.swapcase();

参数

  • NA。

返回值

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

实例

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

实例

#!/usr/bin/python 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 教程 文章: https://codercto.com/courses/l/8.html

查看所有标签

Designing Programmes

Designing Programmes

Karl Gerstner / Springer Verlag / 2007 / $499.00

Karl Gerstnera (TM)s work is a milestone in the history of design. One of his most important works is Designing Programmes, which is presented here in a new edition of the original 1964 publication. I......一起来看看 《Designing Programmes》 这本书的介绍吧!

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

各进制数互转换器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具