av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)Python教程:Python expandtabs()

python 中的expandtabs()函數(shù)有助于將字符串中的' \t '字符替換為空格。該函數(shù)允許指定所需的空間量。最后,修改后的字符串作為輸出返回。

濰城ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!

**string.expandtabs(tabsize)** #where tabsize is an integer value

expandtabs()參數(shù):

expandtabs()函數(shù)接受一個(gè)參數(shù)。如果我們需要替換多個(gè)制表符,那么制表符之前的字符只有在到達(dá)前一個(gè)制表符時(shí)才被計(jì)數(shù)。

參數(shù)描述必需/可選
tabsize指定 tabsize 的數(shù)字。默認(rèn) tabsize 為 8可選擇的

expandtabs()返回值

返回值始終是字符串。它返回使用空格擴(kuò)展后的原始字符串的副本。

| 投入 | 返回值 | | 線 | 帶有空格的字符串 |

Python 中expandtabs()方法的示例

示例 1:如何在沒有參數(shù)的情況下使用expandtabs()?

 string = 'abc\t56789\tefg'

# no argument is passed
# default tabsize is 8
result = string.expandtabs()

print(result) 

輸出:

 abc     56789   efg

示例 2:如何用不同的參數(shù)擴(kuò)展?

 string = "abc\t56789\tdef"
print('Original String:', str)

# tabsize is set to 2
print('Expanded tabsize 2:', string.expandtabs(2))

# tabsize is set to 3
print('Expanded tabsize 3:', string.expandtabs(3))

# tabsize is set to 4
print('Expanded tabsize 4:', string.expandtabs(4))

# tabsize is set to 5
print('Expanded tabsize 5:', string.expandtabs(5))

# tabsize is set to 6
print('Expanded tabsize 6:', string.expandtabs(6)) 

輸出:

 Original String: abc 56789 def
Expanded tabsize 2: abc 56789 def
Expanded tabsize 3: abc   56789 def
Expanded tabsize 4: abc 56789   def
Expanded tabsize 5: abc  56789     def
Expanded tabsize 6: abc   56789 def

當(dāng)前文章:創(chuàng)新互聯(lián)Python教程:Python expandtabs()
瀏覽地址:http://uogjgqi.cn/article/cdjcoog.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們在微信上24小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流