title: How can I pad a sequence of bytes in Python 3?
body: <p>I'm trying to encrypt files like PDFs or executables, but I can't pad it.</p>
  
  <p>I try to read the file in this method:</p>
  
  <pre><code>with('file', 'rb') as file_read:
      line = file_read.read(n) --&gt; n multple of 16
      encrypt(line, key)
  </code></pre>
  
  <p>Then I pass the line to my <code>encrypt</code> function, but when I reach a line that isn't a multiple of 16, my program crashes.</p>
  
  <p>How can I correctly pad a sequence of bytes?</p>