title: How can I make my Python program use 4 bytes for an int instead of 24 bytes?
body: <p>To save memory, I want to use less bytes (4) for each int I have instead of 24.</p>
  
  <p>I looked at structs, but I don't really understand how to use them.
  <a href="https://docs.python.org/3/library/struct.html" rel="nofollow noreferrer">https://docs.python.org/3/library/struct.html</a></p>
  
  <p>When I do the following:</p>
  
  <p><code>myInt = struct.pack('I', anInt)</code></p>
  
  <p><code>sys.getsizeof(myInt)</code> doesn't return 4 like I expected.</p>
  
  <p>Is there something that I am doing wrong? Is there another way for Python to save memory for each variable?</p>
  
  <p>ADDED: I have 750,000,000 integers in an array that I wish to be able to use given an index.</p>