IT-новости про Python, которые стоит знать

Собрали в одном месте самые важные ссылки
читайте нас в Telegram

     07.02.2016       Выпуск 111 (01.02.2016 - 07.02.2016)       Интересные проекты, инструменты, библиотеки

ballpark - человеко-понятное представление чисел

>>> from ballpark import human, scientific, engineering, business
>>> business([11234.22, 233000.55, 1175125.2])
['11K', '233K', '1,180K']
>>>
>>> # or use the shortcut functions
>>> from ballpark import H, S, E, B
>>> B([11234.22, 233000.55, 1175125.2])
['11K', '233K', '1,180K']
>>>
>>> # all notations accept single numbers too, but then we can't
>>> # guarantee that all numbers will have the same prefix (kilo, mega etc.)
>>> [B(value) for value in [11234.22, 233000.55, 1175125.2]]
['11.2K', '233K', '1.18M']