from random import choice from string import digits, ascii_letters def makeTable(headerAndDataList, rows, tableId="tab"): def cellString(cell): cell = str(cell) if cell == "[]": return "None" excludeChars = """<>"'[]""" for c in excludeChars: if c in cell: cell = cell.replace(c, "") return cell def td(cell): return '' + cellString(cell) + '' def th(cell): return '' + cellString(cell) + '' table = '''''' for i in headerAndDataList: table += th(i[0]) table += '''\n''' for row in rows: table += '' for i in headerAndDataList: table += td(eval(i[1])) table += '\n' table += '''



''' return table def appointmentDate(date): return date.strftime("%a %d.%m.%Y") def randomPassword(): return ''.join(choice(ascii_letters + digits) for i in range(12)) def titleToTemplate(page): return page.lower().replace(" ", "_")