title: Python 3: how to send random number of bytes over the COM(serial) port
body: <p>I wrote a Python script in which I can send fixed bytes through a COM port.</p>
  
  <pre><code>ser.write(bytes('0123456789',encoding='ascii'))
  </code></pre>
  
  <p>I want to parameterize the number of bytes that the script can send.  </p>
  
  <p>Can anyone please suggest me how I can do this?</p>
  
  <p>Thanks.</p>