Size

This module manages sizes as they are reported by various UNIX commands.
Download

Size Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Alain Barthe
  • Publisher web site:
  • http://www.albar.fr/

Size Tags


Size Description

This module manages sizes as they are reported by various UNIX commands. Size is a Python module that manages sizes of devices like files, block devices or system memory, as they are reported by various UNIX commands. It can be useful for people who often parse command outputs, log file, etc, looking for sizes in various units and formats to compare and compute them, then print results in a homogeneous way.>>> from Size import mkSize>>> a = mkSize('20 Gb') # Default unit is 'm'>>> b = mkSize('0.1T', 'k') # Size in kilobytes from string in Tera>>> a, b(20480.0, 107374182.40000001) # a and b are float>>> a(), b() # sizes are callable('20480 Mb', '107374182 Kb') # Results in human readable string>>> c = b - a # Sizes may be added or substracted>>> d = a * 3 # or divided or multiplied>>> d.g('%dMBytes') # Sizes may be converted in differents units'60GBytes' # and printed with differents formats>>> b.smartprint(6) # Size may be printed with the smallest unit'102 Gb' # that fills a given length>>> b.smartprint(10) #'104857 Mb' Requirements: · Python


Size Related Software