I have to append some rows into a csv file using python.
Here is my code.
import csv # Variable row contains records of all users similar to this below # ["Name", "City", "Email", "Average", "Total", "Grade", "Remarks"] with open("file.csv", "a", newline = "") as f: writer = csv.writer(f) for item in row: writer.writerow(item) f.close() The Problem I am facing here is the "Average" is in the form of "10 / 2" or sometimes "28 / 4" etc.
The First parameter is the average score ( 10 ) and the second parameter is the number of attempts ( 2 ) for the case ( 10 / 2 ).
When I write this data using the above code to the csv file it automatically converts like this below.
"10 / 2" ---> "10 Feb"
"28 / 4" ---> "28 April"
