1. ใช้ isupper()
>> 'Hello world'.isupper() False >>> 'HELLO'.isupper() True
2. ใช้ Regex ^[A-Z]+$
>> import re
>>> bool(re.match('^[A-Z]+$', '123aAbc'))
False
>>> bool(re.match('^[A-Z]+$', 'ABC'))
True
1. ใช้ isupper()
>> 'Hello world'.isupper() False >>> 'HELLO'.isupper() True
2. ใช้ Regex ^[A-Z]+$
>> import re
>>> bool(re.match('^[A-Z]+$', '123aAbc'))
False
>>> bool(re.match('^[A-Z]+$', 'ABC'))
True