Search code examples
pythonpython-3.xcsvexport-to-csvtxt

Differentiate numbering format in csv file


I exported string of numbers from python into a csv file:

When I open it in notepad, the data looks as such which is the real data:

enter image description here

However if I open it in excel sheet, the data looks as such which is false:

enter image description here

Can somebody please let me know how do I get to see following string of letters in the csv file:

Cell A1: 15

Cell A2: 15.0

Cell A3: 15.00

Cell A4: 15.000


Solution

  • That is not actually done by csv file, but you are opening it in excel. So, Excel is just ignoring .000s and yeah! If you read that file using other program or python also then you will get .0 for sure.

    You can look this article for, how to change that feature. If you are having hard time while saving csv file then, you may look here