durationstring

Get readable time in seconds.


License
MIT
Install
pip install durationstring==1.2.3

Documentation

durationstring

A small module to assist in getting readable time in seconds that can be easily passed to time.sleep(seconds).

Converters

  • s - seconds
  • m - minutes
  • h - hours
  • d - days

Failing to provide a converter will default to seconds.

Examples

import duration_string
import time
time.sleep(duration_string.get("2m"))
duration_string.is_valid("2f") # raises ValueError

Tests

These are run using docstrings.