Reading UTF-8 Encoded Files and Text Files in Python3

前端 未结 2 1115
甜味超标
甜味超标 2020-12-11 17:42

Ok, so python3 and unicode. I know that all python3 strings are actually unicode strings and all python3 code is stored as utf-8. But how does python3 reads text files? Does

2条回答
  •  囚心锁ツ
    2020-12-11 18:05

    Do I need to call decode('utf-8') when reading a text file?

    You need to try-read a text file to make sure it's utf-8 encoding in the file.

提交回复
热议问题