Pythonのlstrip()メソッド
説明
Pythonのlstrip()メソッドは、スペースまたは左側に指定した文字列を切り出すために使用されます。
文法
lstrip()メソッドの構文:
str.lstrip([chars])
パラメータ
- 文字 - 指定された文字取ら。
戻り値
空白のままか、後に文字列を指定された切断結果の新しい文字列を返します。
例
次の例では、()を使用するlstripを示しています。
#!/usr/bin/python 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