Python - 'ascii' codec can't decode byte

前端 未结 7 754
旧巷少年郎
旧巷少年郎 2021-01-30 17:08

I\'m using Python 2.6 and Jinja2 to create HTML reports. I provide the template with many results and the template loops through them and creates HTML tables

When callin

7条回答
  •  忘掉有多难
    2021-01-30 17:30

    Simple strings may contain UTF-8 character bytes but they are not of type unicode. This can be fixed by "decode" which converts str to unicode. Works in Python 2.5.5.

    my_string_variable.decode("utf8")

提交回复
热议问题