猫史档案馆


【Python作品分享】英汉互译器

用户:yfvstGyfvstG查看:0 回复:0 评论:0 创建时间:2021-04-20T18:46:32


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import ybc_trans as trans
import ybc_box as box


op = box.buttonbox('请选择', ['英译汉', '汉译英'])
w = box.enterbox('请输入翻译内容')
if op == '英译汉':
    r1 = trans.en2zh(w)
    box.msgbox(r1)
    f1 = open('英译汉.txt', 'a')
    f1.write(w + ' --> ' + r1 + '\n')
    f1.close()
elif op == '汉译英':
    r2 = trans.zh2en(w)
    box.msgbox(r2)
    f2 = open('汉译英.txt', 'a')
    f2.write(w + ' --> ' + r2 + '\n')
    f2.close()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页