Mar-14-2020, 09:17 PM
I'm trying to take a string value from a cell in one csv file and write it to a cell in a different csv file.
The problem I'm running into is that when the string is written into the second csv file, it is being split into two cells.
For example, in the first csv file the value in the cell is '20'. When it is written to the second csv file '2' goes in one cell and '0' goes in a second cell. How do i get '20' to go into one cell? below is my code. thanks for any help!
The problem I'm running into is that when the string is written into the second csv file, it is being split into two cells.
For example, in the first csv file the value in the cell is '20'. When it is written to the second csv file '2' goes in one cell and '0' goes in a second cell. How do i get '20' to go into one cell? below is my code. thanks for any help!
import csv f_read_name = 'csv_test.csv' f_write_name = 'csv_test_write.csv' with open(f_read_name) as f_rn: reader = csv.reader(f_rn) header = next(reader) size = [] for row in reader: size.append(row[0]) last = size[-1] with open(f_write_name, 'a', newline='') as f_wn: write_file = csv.writer(f_wn) write_file.writerow(last)