I am getting this unicode in my program which interrupts the output by assuming it to be charcter

24 Views Asked by At

I made a csv file

import csv, datetime
a=open('data.csv','r+')
write=csv.writer(a,delimiter=',')
write.writerow(('Ord_ID','Custm_Name','M.No.','Odr.','Qty.','Date')) 
write.writerow((1,'Aa**sh','8171xxxxxx','pinecake',2,datetime.datetime.now())) 

And here it the program I use to extract data.


a=open('data.csv','r+')

import csv

read=csv.reader(a)

data=[]

for i in read:

    data.append(i)

print(data)

Output:

[['\ufeffOrd_ID', 'Custm_Name', 'M.No.', 'Odr.', 'Qty.', 'Date'], ['1', 'Aa**sh', '8171xxxxxx', 'pinecake', '2', '2023-12-21 14:49:57.789029']]
print(len(data[0][0]))
7
print('Ord_ID')
6

So I do not know how to remove that unicode from Ord_ID column or what to change so it does not happen

Not changing the list object

0

There are 0 best solutions below