# 示例代码:使用 upper() 函数将字符串转换为大写
# 定义一个字符串
text = "hello, world!"
# 使用 upper() 函数将字符串转换为大写
upper_text = text.upper()
# 输出结果
print(upper_text)  # 输出: HELLO, WORLD!upper() 是 Python 字符串的一个内置方法,用于将字符串中的所有小写字母转换为大写字母。text,然后调用 upper() 方法将其转换为大写,并将结果存储在变量 upper_text 中。print() 函数输出转换后的字符串。Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站