python error in reading number from csv

I have a csv file like – order_id,name,address
When i try to insert data from csv to postgresql table via python it does not read the number properly.

e.g let data be

order_id  |  name  |  address
----------+--------+----------
5432548543| Manish | Dummy Address

it reads the order_id like 5.43E+9 instead of whole number. my code is like:

filename.encode('utf-8')
with open(filename) as file:
    dict = csv.DictReader(file)
        cur.executemany("""Insert into temp_unicom values(%(Order Id)s,%(Name)s,%(Address)s)""",dict)
        file.close()

Here Order ID, Name, Address are headers of my csv file.

How to correctly format the data?


Source: python

Leave a Reply