dict_dict_2_txt

yoda_powers.display.dict_dict_2_txt(dico, first='Info', sep='\t')[source]

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

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

  • first (str) – the first column header name. Default to ‘Info’.

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

Returns

formated dict to string

Return type

str

Examples

>>> dico = {"Souche1":{"NUM":"171","MIN":"2042","MAX":"3133578","N50 BP":"938544","N50 NUM":"11"},
            "Souche2":{"NUM":"182","MIN":"5004","MAX":"74254","N50 BP":"45245"}}
>>> dict_dict_2_txt(dico,"souches")
souches NUM     MIN     MAX     N50 BP  N50 NUM
Souche1 171     2042    3133578 938544  11
Souche2 182     5004    74254   45245   None