'ascii' codec can't encode character at position * ord not in range(128)

后端 未结 2 665
醉酒成梦
醉酒成梦 2021-02-14 16:28

There are a few threads on stackoverflow, but i couldn\'t find a valid solution to the problem as a whole.

I have collected huge sums of textual data from the urllib rea

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-14 17:05

    You can do it through smart_str of Django module. Just try this:

    from django.utils.encoding import smart_str, smart_unicode
    
    text = u'\u2019'
    print smart_str(text)
    

    You can install Django by starting a command shell with administrator privileges and run this command:

    pip install Django
    

提交回复
热议问题