Search code examples
pythonmutt

One Extra line is added when using mutt for .csv file


I am using python 3 and this is my code

   with open(f"{datetime.datetime.now().strftime(DATETIME_FORMAT)}.csv", "w", newline="") as f:
        w = csv.writer(f)

When I import file from my server to local(Macbook) it shows files in correct format.

when sending email using mutt command, it is adding extra line between each row.


Solution

  • This worked for me: This removed extra lines from output .csv:

    open(f"RMA{datetime.datetime.now().strftime(DATETIME_FORMAT)}.csv", "w", newline="") as f:
        w = csv.writer(f, lineterminator='\n')