string.translate() with unicode data in python

后端 未结 5 486
情书的邮戳
情书的邮戳 2020-12-03 05:05

I have 3 API\'s that return json data to 3 dictionary variables. I am taking some of the values from the dictionary to process them. I read the specific values that I want t

5条回答
  •  误落风尘
    2020-12-03 05:34

    In this version you can relatively make one's letters to other

    def trans(to_translate):
        tabin = u'привет'
        tabout = u'тевирп'
        tabin = [ord(char) for char in tabin]
        translate_table = dict(zip(tabin, tabout))
        return to_translate.translate(translate_table)
    

提交回复
热议问题