python中的upper、lower、capitalize、title
2024-08-29 15:57:03
upper()字符串中字母由小写变为大写
lower()字符串中字母由大写变为小写
capitalize()字符串中字母首字母大写其余小写
title()字符串中字母每个单词的首字母大写其余小写
举个列子:
1 a = "hello"
2 b = "WORLD"
3 c = "hello"
4 d = "hello world"
5 a1 = a.upper()
6 b1 = b.lower()
7 c1 = c.capitalize()
8 d1 = d.title()
9 print(a1)
10 print(b1)
11 print(c1)
12 print(d1)
输出结果:
HELLO
world
Hello
Hello World
实际运用就如上面代码书写。
最新文章
- ES6(四) --- 正则 Number Math
- Azure 新的管理模式 —— Resource Manager
- Difference between web server ,web container and application server
- Oracle 11g XE release2安装与指导
- elf文件中的.plt .rel.dyn .rel.plt .got .got.plt的关系
- SQLServer视图
- 模拟实现ORM实例
- 硅谷新闻1--引导界面GuideActivity
- java 学习路线《转》
- Entity Framework with MySQL 学习笔记一(关系整理版)
- mysql 时间
- Linux下的视频字幕编辑
- linux命令类型及执行顺序
- Java中List集合的三种遍历方式(全网最详)
- python-inotify 在linux上安装
- DUILIB UI创建过程
- 多条件分类统计group by 显示数目为0的类别
- [DP][NOIP2015]子串
- LeetCode(41):缺失的第一个正数
- Repeater 中TextBox 触发TextChanged事件