title: How to initialize a ctypes array in Python from command line
body: <p>So I have been tasked with writing a Python script which accesses a Win 32 DLL to perform some functionality. This script needs to accept parameters from the command line then output other parameters.</p>
  
  <p>I am using ctypes since it is the easiest way I have found to pass parameters to the Win 32 DLL methods but I was lucky enough to have a fixed array of values from the command line which I solved by doing such:</p>
  
  <pre><code>seed = (ctypes.c_ubyte * 12)(
      ctypes.c_ubyte(int(sys.argv[3], 16)), ctypes.c_ubyte(int(sys.argv[4], 16)),
      ctypes.c_ubyte(int(sys.argv[5], 16)), ctypes.c_ubyte(int(sys.argv[6], 16)),
      ctypes.c_ubyte(int(sys.argv[7], 16)), ctypes.c_ubyte(int(sys.argv[8], 16)),
      ctypes.c_ubyte(int(sys.argv[9], 16)), ctypes.c_ubyte(int(sys.argv[10], 16)),
      ctypes.c_ubyte(int(sys.argv[11], 16)), ctypes.c_ubyte(int(sys.argv[12], 16)),
      ctypes.c_ubyte(int(sys.argv[13], 16)), ctypes.c_ubyte(int(sys.argv[14], 16))
  )
  </code></pre>
  
  <p>But this is not dynamic in anyway and I tried to perform this array initialization with a for loop inside the array initialization but without success.</p>
  
  <p>I am completely new to Python and find it rather difficult to do what I consider simple tasks in other languages (not bashing the language, just not finding it as intuitive as other languages for such tasks).</p>
  
  <p>So, is there a way to simplify initializing this array where there could be a variable amount of entries per se?</p>
  
  <p>I have searched and searched and nothing I have found has solved my problem.</p>
  
  <p>All positive and negative comments are always appreciated and both will always serve as a learning experience :)</p>