title: UnicodeDecodeError: 'cp932' codec can't decode byte 0xfc
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import os
  
  for root, dirs, files in os.walk('Path'):
       for file in files:
           if file.endswith('.c'):
               with open(os.path.join(root, file)) as f:
                      for line in f:
                          if 'word' in line:
                              print(line)</code></pre>
  </div>
  </div>
  </p>
  
  <p>getting the error </p>
  
  <p>UnicodeDecodeError: 'cp932' codec can't decode byte 0xfc in position 6616: illegal multibyte sequence</p>
  
  <p>I think file needs shift jis encoding.
  can i set encoding at start only?
  i tried setting 
   with open(os.path.join(root, file),'r',encoding='cp932') as f:
  but got same error</p>