1. 全部转换为大写小写
小写 :‘add’.lower()
大写: ‘add'.upper()
首字母大写:‘add’.capitalize()
标题首字母大写‘hi hello’.title()
本文详细介绍了Python中字符串大小写转换的方法,包括全部转换为大写、小写、首字母大写以及标题首字母大写。通过实例演示了如何使用.lower()、.upper()、.capitalize()和.title()等方法,帮助读者掌握字符串格式化的实用技能。
1. 全部转换为大写小写
小写 :‘add’.lower()
大写: ‘add'.upper()
首字母大写:‘add’.capitalize()
标题首字母大写‘hi hello’.title()
3767
1395

被折叠的 条评论
为什么被折叠?