I have 2 CSV files, say 'a.csv' and 'b.csv'. I want to copy the data of 'a.csv' into 'b.csv'. The whole of 'a.csv' data should be added at the end of the 'b.csv'
import csv
ifile = open('/Users/avtarsingh/Downloads/StocksProject-master/data/nasdaq.csv', 'w', newline='')
read = csv.reader(ifile)
writer = csv.writer(ifile)
for row in ifile.readlines():
writer.writerow(['Avtar'])
print(row)
ifile.close()
=================================================================
New Code:-
with open('/Users/avtarsingh/Downloads/StocksProject-master/data/procter.csv', 'r') as f:
# f = list(f)
for row in f:
print(row)
time.sleep(2)
with open('/Users/avtarsingh/Downloads/StocksProject-master/data/sp.csv', 'r') as g:
for row1 in g:
# g.writerow(f)
print(row1)
with open('/Users/avtarsingh/Downloads/StocksProject-master/data/nasdaq.csv', 'w') as h:
writer = csv.writer(h)
writer.writerows(f)