关于字符串
来源:互联网 发布:十字绣diy软件 编辑:程序博客网 时间:2024/06/05 13:44
1. ljust()
函数的使用:左对齐
Description:
The method ljust()
returns the string left justified(左对齐) in a string of length width
. Padding is done using the specified fillchar
(default is a space). The original string is returned if width is less than len(s)
.
Syntax:
Following is the syntax for ljust()
method :
str.ljust(width[, fillchar])
Parameters:
- width
– This is string length in total after padding.
- fillchar
– This is filler character, default is a space.
使用场景:
看个例子就明白了:
>>> print "Brown:".ljust(15), 97Brown: 97>>> print "Richard Lee:".ljust(15), 90Richard Lee: 90
是不是对齐看起来非常美观。
0 0
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串
- 关于字符串和数组字符串
- 关于MYSQL字符串
- 关于C++字符串
- 关于PostgreSQL的字符串
- 关于字符串的复制
- 关于字符串的总结
- javascript从入门到精通
- Day54、约束(主键约束、唯一约束、检查约束、非空约束)、数据库对象(序列、索引、视图、分页)
- 正则表达式及常见用法介绍
- 第十周项目3-利用二叉树遍历思想解决问题
- 链表(创建、插入、删除、输出链表等)
- 关于字符串
- POJ 2459 模拟
- 三天上手PHP之7:运算符
- commonJs,AMD,CMD区别
- C语言小项目实践——日历程序
- 我所认识到的技术问题解决方法
- C++:堆与栈区别
- android知识回顾--动画深入分析
- register\static\volatile