I've executed your code, it works as expected. The first time I get one row 42,73,50,10,0,23,0.248,21,0, the second time I have two rows (they are obviously the same). Not sure what the bug is.
You don't need to csv_file.close(), it will be handled by with open() automatically. That the whole point of it
Going to mark this as pending to be closed, because of 1.
It seems like Lucas is expecting that csv module will examine the file and if it's non-empty and doesn't end with a newline, prefix the row with a newline. That's not unreasonable but csv docs do not promise that, and it would be a backwards incompatible change, and it's very easy to add a newline explicitly if needed, so I agree this should be closed, and I don't think docs need to clarify this scenario.
Bug report
When I want to add a new row to an existing file it doesn't append a new row. But it extends the last row.
Results :
{'Pregnancies': '1', 'Glucose': '93', 'BloodPressure': '70', 'SkinThickness': '31', 'Insulin': '0', 'BMI': '30.4', 'DiabetesPedigreeFunction': '0.315', 'Age': '23', 'Outcome': '042', None: ['73', '50', '10', '0', '23', '0.248', '21', '0']}The text was updated successfully, but these errors were encountered: