title: python error while reading large files from a folder to copy to another file
body: <p>i'm trying to read files in folder and copy specific part of each file to a new file using the below python code.but getting error as below</p>
  
  <pre><code>import glob
  file=glob.glob("C:/Users/prasanth/Desktop/project/prgms/rank_free1/*.txt")
  fp=[]
  for b in file:
      fp.append(open(b,'r'))
  s1=''
  for f in fp:
      d=f.read().split('\t')
      rank=d[0]
      appname=d[1]
      appid=d[2]
      s1=appid+'\n'
  file=open('C:/Users/prasanth/Desktop/project/prgms/appids_file.txt','a',encoding="utf-8")
      file.write(s1)
      file.close()
  </code></pre>
  
  <p>im getting the following error message</p>
  
  <pre><code>enter code here
  Traceback (most recent call last):
   File "appids.py", line 8, in &lt;module&gt;
  d=f.read().split('\t')
  File "C:\Users\prasanth\AppData\Local\Programs\Python\Python36-
  32\lib\encodings\cp1252.py", line 23, in decode
  return codecs.charmap_decode(input,self.errors,decoding_table)[0]
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 
  12307: character maps to &lt;undefined&gt;
  </code></pre>