Latest web development tutorials

Metodo Python lstrip ()

stringhe Python stringhe Python


descrizione

Metodo Python lstrip () viene utilizzato per tagliare spazi o una stringa di caratteri specificato a sinistra.

grammatica

lstrip () metodo di sintassi:

str.lstrip([chars])

parametri

  • caratteri - il carattere specificato preso.

Valore di ritorno

Restituisce una nuova stringa risultante amputata lasciato vuoto o specificato stringa di caratteri dopo.

Esempi

L'esempio seguente mostra lstrip () da utilizzare:

#!/usr/bin/python

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

Esempi dei risultati di output di cui sopra sono i seguenti:

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

stringhe Python stringhe Python