python opens text file with a space between every character

前端 未结 8 1775
野性不改
野性不改 2021-02-18 17:27

Whenever I try to open a .csv file with the python command fread = open(\'input.csv\', \'r\') it always opens the file with spaces between every single character.

8条回答
  •  耶瑟儿~
    2021-02-18 17:35

    To read an encoded file, you can simply replace open with codecs.open.

    fread = codecs.open('input.csv', 'r', 'utf-16')
    

提交回复
热议问题