thdl.utils.common

thdl.utils.common.now()[source]

Get the format time of NOW.

For example:

>>> now()
>>> "2017-04-26-16-44-56"
Returns:str instance.
thdl.utils.common.today()[source]

Get the format time of TODAY.

For example:

>>> today()
>>> "2017-04-26"
Returns:str instance.
thdl.utils.common.time_format(total_time)[source]

Change the total time into the normal time format.

For examples:

>>> time_format(36)
>>> "36 s"
>>> time_format(90)
>>> "1 min 30 s "
>>> time_format(5420)
>>> "1 h 30 min 20 s"
>>> time_format(20.5)
>>> "20 s 500 ms"
Parameters:total_timefloat or str instance. The total seconds of the time.
Returns:str instance. The format string about time.
thdl.utils.common.dict_to_str(dict_obj, js='-')[source]

Change dict object to string.

Parameters:
  • dict_objdict instance. The dict object to string.
  • jsstr instance. The join symbol of keys and values.
Returns:

str instance. Return the string object.