Latest web development tutorials

Metodo Python swapcase ()

stringhe Python stringhe Python


descrizione

Metodo Python swapcase () viene utilizzata per convertire una stringa di lettere maiuscole e minuscole.

grammatica

swapcase () metodo di sintassi:

str.swapcase();

parametri

  • NA.

Valore di ritorno

Restituisce un nuovo caso stringa lettere dopo generato la conversione.

Esempi

L'esempio seguente mostra swapcase () per usare:

#!/usr/bin/python

str = "this is string example....wow!!!";
print str.swapcase();

str = "THIS IS STRING EXAMPLE....WOW!!!";
print str.swapcase();

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

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

stringhe Python stringhe Python