以下是expandtabs()方法的语法:
str.expandtabs(tabsize=8)
参数
返回值
此方法返回在制表符,即通过空格进行了扩展字符串,' '的副本。
例子
下面的例子显示expandtabs()方法的使用。
#!/usr/bin/python str = "this is string 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!!!
Copyright © 2019- gbjl.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务