Latest web development tutorials

python3 lstrip()メソッド

python3文字列 python3文字列


説明

lstrip()メソッドは、スペースまたは左側に指定した文字列を切り出すために使用されます。

文法

lstrip()メソッドの構文:

str.lstrip([chars])

パラメータ

  • 文字 - 指定された文字取ら。

戻り値

空白のままか、後に文字列を指定された切断結果の新しい文字列を返します。

次の例では、()を使用するlstripを示しています。

#!/usr/bin/python3

str = "     this is string example....wow!!!     ";
print( str.lstrip() );
str = "88888888this is string example....wow!!!8888888";
print( str.lstrip('8') );

次のように上記の出力結果の例は次のとおりです。

this is string example....wow!!!     
this is string example....wow!!!8888888

python3文字列 python3文字列