一、upper函数
- 语法:
str.upper()
- 返回值:返回一个新的字符串,其中所有字符都被转换为大写。
python`s = "hello world"
print(s.upper()) # 输出:HELLO WORLD`
二、lower函数
- 语法:
str.lower()
- 返回值:返回一个新的字符串,其中所有字符都被转换为小写。
python`s = "HELLO WORLD"
print(s.lower()) # 输出:hello world`
str.upper()
python`s = "hello world"
print(s.upper()) # 输出:HELLO WORLD`
str.lower()
python`s = "HELLO WORLD"
print(s.lower()) # 输出:hello world`