title: generate file hash in python
body: <p>hi this code generate sha1 hash but hash differ from other tools generate  sha1 hash from this file:</p>
  
  <pre><code>import os
  import hashlib
  
  fileList = os.listdir("D:\\a\\")
  for i in fileList:
  d=(hashlib.sha1(file("D:\\a\\"+i, 'r').read()).hexdigest())
  # os.rename(i,d)
  print(d)
  </code></pre>
  
  <p>in MD5 so i have this problem!!
  why? </p>
  
  <hr>
  
  <p>edit: 'rb'  solve my problem </p>