CSV downloads a string as scientific notation

Viewed 23

I have some data (string) that can be downloaded in a CSV file but when I open it the format changes to a scientific notation. For example, this string 1316E2 is shown as 1,316E+05. I found a way of changing this manually by adding quotation marks, changing the cell format, and then deleting the quotation marks but of course, this is not what I want. I want to see the file with the correct data from the beginning. I'm just using CSV and python. Is realistic to try to find a solution for this or this just happens because of CSV/excel configuration?

This is not the code I have but I hope it can help as example:

import csv 

header = ['code']
data = ['1316E2']

with open('example.csv', 'w', encoding='UTF8') as f:
    writer = csv.writer(f)

    # write the header
    writer.writerow(header)

    # write the data
    writer.writerow(data)

This is the output: code output

0 Answers
Related