Metodo rstrip python3 ()
descrizione
rstrip () per cancellare il fine stringa di caratteri specificata della stringa (predefinito è uno spazio).
grammatica
rstrip () metodo di sintassi:
str.rstrip([chars])
parametri
- caratteri - il carattere specificato eliminato (di default è vuoto)
Valore di ritorno
Rientro nuova generazione stringa eliminata alla fine della stringa alla stringa di caratteri specificato dopo.
Esempi
L'esempio seguente mostra rstrip () per usare:
#!/usr/bin/python3 str = " this is string example....wow!!! " print (str.rstrip()) str = "*****this is string example....wow!!!*****" print (str.rstrip('*'))
Esempi dei risultati di output di cui sopra sono i seguenti:
this is string example....wow!!! *****this is string example....wow!!!