upper, lower。方法仅返回改动后的字符串,不改变传入字符串本身。
mystr='''The song I came to sing
remains unsung to this day.
I have spent my days in stringing
and in unstringing my instrument.
The time has not come true,'''
print(mystr)
mystr=mystr.upper()
print(mystr)
mystr=mystr.lower()
print(mystr)
isupper, islower()。字符串至少有一个字母,且所有字母都为大写或小写。成员函数。
str1='hello world'
str2='HELLO WORLD'
str3='12345'
bool1=str1.islower()
bool2=str2.isupper()
bool3=str3.isupper()
print(bool1)
print(bool2)
print(bool3)