2021-08-27

Issue appending to csv using python

I'm trying to write a script that saves prices into a csv file however for 2 of the inputs it adds quotation marks when appending to the csv file. This is the code when i print it off above it does not show the quotations.

    def insert_data(self, data):  
        for p in data:
            print(p)
        with open ('tracker_file.csv', 'a') as csv_file:
            writer = csv.writer(csv_file)
            writer.writerow(data)

This is what is append to the file

   2021-08-26,21:57:12,"34,307.65","2,272.25",123.72,447.77

This is the output of the print function

    2021-08-26
    21:57:12
    34,307.65
    2,272.25
    123.72
    447.77

Not to sure what could be causing this? any help would be appreciated, thanks :3



from Recent Questions - Stack Overflow https://ift.tt/3Bg4Uiy
https://ift.tt/eA8V8J

No comments:

Post a Comment