素手华筝,tokyo hot n0635,吴俐璇
expandtabs()方法返回制表符,即该字符串的一个副本。 '\t'已经使用的空间,可选择使用给定的tabsize(默认8)扩展。
语法
以下是expandtabs()方法的语法:
str.expandtabs(tabsize=8)
参数
返回值
此方法返回在制表符,即通过空格进行了扩展字符串,'\t'的副本。
例子
下面的例子显示expandtabs()方法的使用。
#!/usr/bin/python str = "this is\tstring example....wow!!!"; print "Original string: " + str; print "Defualt exapanded tab: " + str.expandtabs(); print "Double exapanded tab: " + str.expandtabs(16);
当我们运行上面的程序,它会产生以下结果:
Original string: this is string example....wow!!! Defualt exapanded tab: this is string example....wow!!! Double exapanded tab: this is string example....wow!!!
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python爬虫:Request Payload和Form Data的简单区别说明
浅谈Python中threading join和setDaemon用法及区别说明
Python3-异步进程回调函数(callback())介绍
python继承threading.Thread实现有返回值的子类实例
Python中使用threading.Event协调线程的运行详解
网友评论