title: Convert file into BytesIO object using python
body: <p>I have a file and want to convert it into <code>BytesIO</code> object so that it can be stored in database's varbinary column.</p>
  
  <p>Please can anyone help me convert it using python.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>f = open(filepath, "rb")
  print(f.read())
  
  myBytesIO = io.BytesIO(f)
  myBytesIO.seek(0)
  print(type(myBytesIO))
  </code></pre>