I have these lines to get filenames in a folder.
# -*- coding: utf8 -*-
import os, sys
reload(sys)
sys.setdefaultencoding('utf8')
file_folder = "C:\\tem\\"
root, dirs, files = os.walk(file_folder).next()
for path, subdirs, files in os.walk(root):
for f in files:
print file_folder + f
It doesn’t work when the folder contains .xlsb files. (Excel Binary Workbook file)
The error returned is:
[Decode error - output not utf-8]
I tried changed the last line to encode/decode to make them work but still can’t.
How can I have them displayed properly?