久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      python中strip()函數(shù)有什么用法

      python中strip()函數(shù)有什么用法

      Python中strip() 方法用于移除字符串頭尾指定的字符(默認(rèn)為空格或換行符)或字符序列。

      注意:該方法只能刪除開(kāi)頭或是結(jié)尾的字符,不能刪除中間部分的字符。

      str.strip([chars])

      chars為需要移除的字符序列。

      返回值為移除指定字符序列后產(chǎn)生的新序列。

      str="  000120abc021000 n" #用于移除字符串頭尾指定的字符(默認(rèn)為空格或換行符)或字符序列。 print(str.strip() print() # str1="000120abc021000" #刪除字符串開(kāi)頭和結(jié)尾指定為0的字符 print(str1.strip('0')) print() #刪除字符串開(kāi)頭指定為0的字符 print(str1.lstrip('0')) print() #刪除字符串結(jié)尾指定為0的字符 print(str1.rstrip('0'))

      運(yùn)行結(jié)果如下:

      python中strip()函數(shù)有什么用法

      推薦教程:python教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)