用参数2判断解密还是加密: 直接用maketrans()和translate() def fun(a,b): before='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' after ='bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA1234567890' if b==1: ...