I want to print data from my database in a better format, this is for a game I made. This is the code:
def read_all_tables(self):
self.cursor.execute('SELECT Name, Gender, Age, Score, Date, Time FROM Link JOIN Scores ON Score_ID = Scores.ID JOIN Player ON Player_ID = Player.id ORDER BY Score DESC')
Data = self.cursor.fetchall()
for Row in Data:
print()
for record in range(len(Row)):
print(Row[record], end=" ")
The output is:
HAMMAD MALE 18 900 07/01/18 13:07:02
HAMMAD MALE 18 850 07/01/18 13:30:11
INDERVEER MALE 18 750 07/01/18 13:35:46
HAMMAD MALE 18 500 07/01/18 13:08:29
HAMMAD MALE 18 400 07/01/18 14:07:29
PARSA MALE 18 300 07/01/18 13:36:58
HADIA FEMALE 19 300 07/01/18 14:09:37
MANAAL FEMALE 18 100 07/01/18 13:51:40
MICHAL MALE 18 0 07/01/18 13:42:41
HAMMAD MALE 18 0 07/01/18 13:44:04
HADIA FEMALE 19 0 07/01/18 13:45:51
MANAAL FEMALE 18 0 07/01/18 13:53:02
JACK WEIRD 21 0 07/01/18 13:53:49
HAMMAD MALE 18 0 07/01/18 13:54:44
HAMMAD MALE 18 0 07/01/18 13:56:08
MANAAL FEMALE 18 0 07/01/18 13:57:39
PARSA MALE 18 0 07/01/18 13:58:25
HAMMAD MALE 18 0 07/01/18 13:59:08
HAMMAD MALE 18 0 07/01/18 14:10:37
How can I align them and have a column heading? I would like not to use any library.