python中的expandtabs、\t
expandtabs()将tab转换成空格,默认1个tab转成8个空格,\t制表符代表一个tab,我们也可以自定义转换成几个空格
举个例子:
1 a = "hello\tworld"
2 a1 = a.expandtabs()
3 a2 = a.expandtabs(10)
4 print(a1)
5 print(a2)
输出结果:
hello world
hello world
使用方式如代码书写
posted on
2019-04-09 10:16
恒笛 阅读(
...) 评论(
)
编辑
收藏
转载于:https://www.cnblogs.com/xwqhl/p/10675262.html
相关资源:数据结构—成绩单生成器