字符串反码A

while True:
    try:
        string=input()
        if string!="!":
            res=""
            for i in string:
                if i.isupper():
                    res+=chr(ord("Z")-(ord(i)-ord("A")))
                elif i.islower():
                    res += chr(ord("z") - (ord(i) - ord("a")))
                else:
                    res+=i
            print(res)
    except:
        break
原文地址:https://www.cnblogs.com/670ling/p/12547243.html