Python csv file write garbage problem

Copyright: please indicate the source https://blog.csdn.net/LI_AINY/article/details/90039391
  1. python written documents have been garbled, set the time to write utf-8 encoded
    Here Insert Picture Description
  2. Solution, add a BOM,
    BOM (Byte Mark the Order), the byte order mark, the head appears in the text file, Unicode encoding standard used to identify which files are encoded using the format, but it is for readers who file is invisible characters.
  3. Direct change encoded as utf-8-sig
    Here Insert Picture Description
    then execute successfully!
    Here Insert Picture Description

Guess you like

Origin blog.csdn.net/LI_AINY/article/details/90039391