python字符串应用总结

name = “Hello python, I am coming!”

# 首字母大写

print(name.title())

# 全都大写

print(name.upper())

# 全都小写

print(name.lower())

# 字符串拼接

print(name + "My name is python!")

# 删除左侧空白

print(name.lstrip())

# 删除右侧空白

print(name.rstrip())

# 删除两变空白

print(name.strip())

注:使用字符串时要用 "" 包含 '' 

原文地址:https://www.cnblogs.com/zhangshuang0909/p/9533574.html