用Python2.7.10编写凯撒密码加密和解密程序

s = raw_input('[开始加密]please input your str:')

s = list(s)

n = 0

for sw in s:

s[n] = chr(ord(sw)+3)

n = n + 1

sout = ''

python加密,python加密代码

for sw2 in s:

sout = sout + sw2

print '[加密结果]:',sout

解密的类似,主要用到ord、chr函数。