无涯教程-Python - upper()函数

56 阅读1分钟

Python up()返回字符串的副本,其中所有基于大小写的字符都已大写。

upper() - 语法

str.upper()

upper() - 返回值

此方法返回字符串的副本,其中所有基于大小写的字符都已大写。

upper() - 示例

下面的示例显示up()方法的用法。

#!/usr/bin/python

str="this is string example....wow!!!"; print "str.capitalize() : ", str.upper()

当无涯教程运行上面的程序时,它产生以下输出-

str.capitalize() :  THIS IS STRING EXAMPLE....WOW!!!

参考链接

www.learnfk.com/python/stri…