中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Python expandtabs()方法

Python 字符串 Python 字符串


描述

Python expandtabs() 方法把字符串中的 tab 符號('t')轉(zhuǎn)為空格,tab 符號('t')默認(rèn)的空格數(shù)是 8。

語法

expandtabs()方法語法:

str.expandtabs(tabsize=8)

參數(shù)

  • tabsize -- 指定轉(zhuǎn)換字符串中的 tab 符號('t')轉(zhuǎn)為空格的字符數(shù)。

返回值

該方法返回字符串中的 tab 符號('t')轉(zhuǎn)為空格后生成的新字符串。

實(shí)例

以下實(shí)例展示了expandtabs()方法的實(shí)例:

#!/usr/bin/python

str = "this iststring example....wow!!!";


print "Original string: " + str;
print "Defualt exapanded tab: " +  str.expandtabs();
print "Double exapanded tab: " +  str.expandtabs(16);

以上實(shí)例輸出結(jié)果如下:

Original string: this is        string example....wow!!!
Defualt exapanded tab: this is string example....wow!!!
Double exapanded tab: this is         string example....wow!!!

Python 字符串 Python 字符串

其他擴(kuò)展