1. print()为输出函数
.title()以首字母大写的形式输出字符串
message = "hello python world!"
print(message.title())
answer:
2. .upper()以全大写的形式输出字符串
.lower()以全小写的形式输出字符串
message = "hello python world!"
print(message.upper())
print(message.lower())
answer:
3. "+"用来拼接字符串
first_name = "hello"
last_name = "python world"
full_name = last_name+" "+first_name
print(full_name)
answer:
4.数字需转换成字符串才可以输出
age = 23
message = "My age is " +str(age)
print(message)
answer:
5. .strip()去掉左右两边的空格
message =" python python"
print(message.rstrip())
print(message.lstrip())
print(message.strip())
answer: