Python3 Rot_13算法
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@Author : HeliantHuS
@Time : 2018/12/17 8:26
@Version : 1.0
@Contact : 1984441370@qq.com
'''
import string
s1 = "a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws"
rot13_1 = string.ascii_lowercase[:13]
rot13_2 = string.ascii_lowercase[13:]
result = []
for i in s1:
find_1 = rot13_1.find(i.lower())
if find_1 != -1:
if i.isupper():
result.append(rot13_2[find_1].upper())
continue
result.append(rot13_2[find_1])
find_2 = rot13_2.find(i.lower())
if find_2 != -1:
if i.isupper():
result.append(rot13_1[find_2].upper())
continue
result.append(rot13_1[find_2])
if find_1 == -1 and find_2 == -1:
result.append(i)
print("". join(result))
s1里面填写要转码的字符串!!!
程序不是年轻的专利,但是,他属于年轻。