例如:(推荐学习:python视频教程)
>>> str_1 = hello python # 全大写>>> str_2 = hello python # 大小写混合>>> str_3 = hello python # 单词首字母大写>>> str_4 = hello python # 全小写
isupper() 判断是否全是大写
>>> str_1.isupper()true>>> str_2.isupper()false>>> str_3.isupper()false>>> str_4.isupper()false
islower()判断是否全是小写
>>> str_1.islower()false>>> str_2.islower()false>>> str_3.islower()false>>> str_4.islower()true
istitle()判断首字母是否大写, 其余的是否小写
>>> str_1.istitle()false>>> str_2.istitle()false>>> str_3.istitle()true>>> str_4.istitle()false
更多python相关技术文章,请访问python教程栏目进行学习!
以上就是python用函数怎么判断大小写的详细内容。
