Python中字母大小写转换
(1)转字母
ch=input("请输入字母:")
if ch>'a' and ch<'z':
print("大写:",ch.upper())
elif ch>='A' and ch<='Z':
print("小写:",ch.lower())
else:
print("输入错误")
#(2)字符串(全转)
ch=input("请输入字母:")
print(ch.swapcase())
#a小转大
ch=input("请输入字母:")
print(ch.swapcase())
#b大转小
ch=input("请输入字母:")
print(ch.swapcase())
#(3)开头首字母大写
ch=input("请输入字母:")
print(ch.capitalize())
#(4)标题样式
ch=input("请输入字母:")
print(ch.title())