I am stuck on this one and I am sure the answer is a simple one. I am new to python and am learning my way around.
I am working on a small project that needs to look at content of all .csv files in a directory. Each file has only 1 row, with 2 columns (ID and DateTime). I have a python script in the same directory as follows;
import glob
path = '*.csv'
files=glob.glob(path)
for file in files:
f=open(file, 'r')
print ('%s' % f.readlines())
This returns the data I need to the terminal, from here I would like to take this data and create another .csv file with the same 2 columns. Effectively all of the single row data files are to be consolidated into one file. Once I have this new consolidated .csv file I can work with it. How can I take all the data returned to the terminal to create a new .csv file?
Many thanks