W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
Python lstrip() 方法用于截掉字符串左邊的空格或指定字符。
lstrip()方法語(yǔ)法:
str.lstrip([chars])
返回截掉字符串左邊的空格或指定字符后生成的新字符串。
以下實(shí)例展示了lstrip()的使用方法:
#!/usr/bin/python
str = " this is string example....wow!!! ";
print str.lstrip();
str = "88888888this is string example....wow!!!8888888";
print str.lstrip('8');
以上實(shí)例輸出結(jié)果如下:
this is string example....wow!!! this is string example....wow!!!8888888
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: