s = input(‘请输入一个字符:‘) if ‘a‘ <= s <= ‘z‘: print(chr(ord(s) - 32)) elif ‘A‘ <= s <= ‘Z‘: print(chr(ord(s) + 32)) else: print(‘s‘)
python 输入一个字符,是小写转换为大写,大写转换为小写,其他字符原样输出
原文:https://www.cnblogs.com/chengxubo/p/9902311.html