Python swapcase () metode
deskripsi
Metode Python swapcase () digunakan untuk mengkonversi string huruf besar dan huruf kecil.
tatabahasa
swapcase () sintaks metode:
str.swapcase();
parameter
- NA.
Kembali Nilai
Mengembalikan huruf string baru setelah konversi yang dihasilkan.
contoh
Contoh berikut menunjukkan swapcase () berfungsi untuk menggunakan:
#!/usr/bin/python str = "this is string example....wow!!!"; print str.swapcase(); str = "THIS IS STRING EXAMPLE....WOW!!!"; print str.swapcase();
Contoh hasil output di atas adalah sebagai berikut:
this is string example....wow!!!