# 编程之家 (jb51.cc)
#利用translate函数将英文标点转换为中文标点
def E_trans_to_C(string):
E_pun = u',.!?[]()<>"\''
C_pun = u',。!?【】()《》“‘'
table= {ord(f):ord(t) for f,t in zip(E_pun,C_pun)}
return string.translate(table)
# End 512.笔记 jb51.cc
原文链接:https://www.f2er.com/python/526838.html