dict_2_txt

yoda_powers.display.dict_2_txt(dico, sep='\t')[source]

Function that takes a dictionary and returns a string with separator:

Parameters
  • dico (dict) – the python dict to translate to formated string.

  • sep (str) – the separator for join . Defaults to ‘t’.

Returns

formated dict to string

Return type

str

Examples

>>> dico = {"key1":"value1","key2":"value2","key3":"value3"}
>>> dict_2_txt(dico)
key1    value1
key2    value2
key3    value3
>>> dict_2_txt(dico, sep=";")
key1;value1
key2;value2
key3;value3

Warning: if the value of the dict is list or dictionary, the display will be plain and without formatting data.