Python 3 教程 Python3 upper()方法

alger · 2022-03-13 18:13:12 · 热度: 16

描述

Python upper() 方法将字符串中的小写字母转为大写字母。

语法

upper()方法语法:

str.upper()

参数

  • NA。

返回值

返回小写字母转为大写字母的字符串。

实例

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

#!/usr/bin/python3

str = "this is string example from codercto....wow!!!";

print ("str.upper() : ", str.upper())

以上实例输出结果如下:

str.upper() :  THIS IS STRING EXAMPLE FROM CODERCTO....WOW!!!

查看更多 Python 字符串内建函数

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册