I have done the following:
a = open(text, encoding='utf-8').read
I am trying to count the words in this text file and include the BOM.
However, when I use readline
, the BOM is not deleted.
Does anyone know how to keep the BOM with read
not readlines
?
Hello I try this and work:
a = open('text.txt',encoding='utf-8').read()
print(a)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.