I have 10 simple text files with 3 columns x,y,z delimited by "space". I am trying to combine these 10 files to get a single text file.
Eg. of data in 10 files is 299 446 2 I had written this prog for merging files: import csv import glob with open(r"C:\Users\inshu.chauhan\Desktop\test2.arff", "w") as w: writer = csv.writer(w, delimiter = ' ', quotechar = ' ' ,quoting = csv.QUOTE_MINIMAL) for f in glob.glob(r"C:\Users\inshu.chauhan\Desktop\For Model_600\*.arff"): rows = open(f, "r").readlines() writer.writerows(rows) But the result after merging the files is not I need , it is something like : 2 9 9 4 4 6 2 2 9 9 4 4 7 2 2 9 9 4 4 8 2 2 9 8 4 4 9 2 Can in some some way I set delimiter to NULL as the prog gives me error if I do so. I dont why there is space between the attribute of first column in reading and there is space between every row too.. Or can I merge these text files without using csv module , directly in python ? Looking forward to your suggestions. Thanks in advance !!!
-- http://mail.python.org/mailman/listinfo/python-list