message= “ hello world ",请用删左边空格、删左右两边空格、删右边空格、首字母大写、全部大写、全部小写,6个函数打印输出值。
以下是使用Python的字符串函数对"hello world"进行处理并打印输出值的代码:
message = " hello world "
# 删左边空格
print(message.lstrip()) # 输出: "hello world "
# 删左右两边空格
print(message.strip()) # 输出: "hello world"
# 删右边空格
print(message.rstrip()) # 输出: " hello world"
# 首字母大写
print(message.capitalize()) # 输出: "Hello world "
# 全部大写
print(message.upper()) # 输出: " HELLO WORLD "
# 全部小写
print(message.lower()) # 输出: " hello world "