title: Get hard disk size in Python
body: <p>I am trying to get the hard drive size and free space using Python (I am using Python 2.7 with macOS).</p>
  
  <p>I am trying with <code>os.statvfs('/')</code>, especially with the following code.
  Is it correct what I am doing? Which definition of the variable <code>giga</code> shall I use?</p>
  
  <pre><code>import os
  
  def get_machine_storage():
      result=os.statvfs('/')
      block_size=result.f_frsize
      total_blocks=result.f_blocks
      free_blocks=result.f_bfree
      # giga=1024*1024*1024
      giga=1000*1000*1000
      total_size=total_blocks*block_size/giga
      free_size=free_blocks*block_size/giga
      print('total_size = %s' % total_size)
      print('free_size = %s' % free_size)
  
  get_machine_storage()
  </code></pre>
  
  <p>EDIT:
  <code>statvfs</code> is deprecated in Python 3, do you know any alternative?</p>