I'm new to Python. I'm trying to open a text file and turn it into an array
The text file looks like this (textile.txt)
1,2022-05-01,37.2,70,18,120,80,95
1,2022-11-01,37.0,72,17,122,80,94
1,2023-05-01,37.1,71,16,121,78,93
1,2023-11-01,37.3,73,18,119,82,96
1,2024-05-01,37.0,69,19,120,80,95
2,2022-06-01,37.6,75,20,130,85,96
2,2022-12-01,37.8,74,19,128,84,95
2,2023-06-01,37.5,72,18,126,83,94
2,2023-12-01,37.7,73,21,130,86,97
2,2024-06-01,37.5,71,20,127,82,94
3,2022-07-01,36.9,68,16,118,75,93
3,2023-01-01,37.0,69,17,119,76,94
3,2023-07-01,36.8,67,15,117,74,92
3,2024-01-01,37.1,70,17,120,77,95
3,2024-07-01,36.9,68,16,118,75,93
I need an array that looks like this.
my_output = []
{1: [['2022-06-01', 37.2, 72, 16, 120, 80, 97], ['2022-09-15', 37.5, 73, 18, 125, 82, 96]], 2: [['2022-06-10', 36.9, 69, 18, 123, 80, 96], ['2023-01-03', 37.1, 71, 19, 124, 81, 97]], 3: [['2022-08-05', 37.3, 74, 20, 126, 83, 95], ['2023-03-01', 37.4, 75, 18, 123, 79, 98]]}
The data types are int, data, float, int, int, int, int
This is what I've been trying
my_output = []
with open ("textile.txt") as f:
for line in f:
id = [item.strip() for item in line.split(',')]
my_output = append(id)
print(my_output)
all I get returned is []