Metode virkne isupper () atgriež, vai visas virknes rakstzīmes ir vai nav ar lielajiem burtiem.
Metodes sintakse isupper()
ir:
string.isupper ()
String isupper () parametri
isupper()
Metode neveic nekādus parametrus.
Atgriezeniskā vērtība no virknes augšdaļas ()
The isupper()
metode atgriež:
- Patiesi, ja visas rakstzīmes virknē ir lielie burti
- Nepatiesa, ja virknē ir mazo burtu rakstzīmes
1. piemērs: Isupper () atgriešanās vērtība
# example string string = "THIS IS GOOD!" print(string.isupper()); # numbers in place of alphabets string = "THIS IS ALSO G00D!" print(string.isupper()); # lowercase string string = "THIS IS not GOOD!" print(string.isupper());
Rezultāts
True True False
2. piemērs: Kā programmā isupper () izmantot programmu?
string = 'THIS IS GOOD' if string.isupper() == True: print('Does not contain lowercase letter.') else: print('Contains lowercase letter.') string = 'THIS IS gOOD' if string.isupper() == True: print('Does not contain lowercase letter.') else: print('Contains lowercase letter.')
Rezultāts
Nesatur mazos burtus. Satur mazo burtu.