'why can't I see the extra line when I directly open the csv file?

I'm learning python on Windows and I met a problem when creating a csv file. Here is the code

import csv

with open("data.csv", "w") as file:
    writer = csv.writer(file)
    writer.writerow(["trasaction_id", "product_id", "price"])
    writer.writerow([1000, 1, 5])

When I open data.csv in VSCode, I get an extra line:

trasaction_id,product_id,price

1000,1,5

I know this problem can be solved by adding newline="" in the open() function. But I don't understand why I can't see the extra line when I directly open this file with Notepad?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source