message = "hello python!"
print(message)
hello world [Finished in 176ms]
msg_hello = ‘hello ‘
msg_py = "python"
print(msg_hello+msg_py)
hello python [Finished in 156ms]
message = "hEllo python"
print(message.title())
print(message.upper())
print(message.lower())
Hello Python
HELLO PYTHON hello python
[Finished in 156ms]
frist_name = "wang"
last_name = "wu"
full_name = f"{frist_name}{last_name}"
message = f"hello,{full_name.title()}"
full_name_format = "{}{}".format(frist_name,last_name)
message_format = "hello,"+full_name_format.title()
print(message)
print(message_format)
hello,Wangwu hello,Wangwu [Finished in 304ms]
print("name:\n\tzhangsan\n\tlisi\nwangwu")
name: zhangsan lisi wangwu [Finished in 328ms]
message = " python "
print(message.lstrip())
print(message.rstrip())
print(message.strip())
python python python [Finished in 156ms]
原文:https://www.cnblogs.com/EwenJi/p/15046880.html