1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-02 05:02:39 +00:00
modufur/src/main/utils/formatter.py
2017-09-24 11:32:35 -04:00

31 lines
635 B
Python

def tostring(i):
o = ' '
if i:
for v in i:
o += v + ' '
o = o[1:-1]
return o
def tostring_commas(i):
if i:
o = ','
for v in i:
o += v + ','
return o[:-1]
return ''
def dict_tostring(i):
o = ''
if i:
for k, v in i.items():
o += '**' + k + ':** `' + tostring(v) + '`\n'
return o
def dictelem_tostring(i):
o = ''
if i:
for dic, elem in i.items():
o += '**__' + dic + '__**\n'
for k, v in elem.items():
o += '***' + k + ':*** `' + tostring(v) + '`\n'
return o