python - Add Header row to multiple .txt files using -
python newbie hoping can little bit of help. have bunch of .txt files listing gps data. create python script open each .txt file in directory , add headers (prior converting .csv , processing esri gis feature classes). have python code list .txt files in target directory , have python code add headers single specified .txt file not sure how tie 2 bits of code whole script process .txt files python code list .txt files: import glob workspace = "c:\\pathway\\totarget" date = time.strftime('%y_%m_%d') directory = workspace + "\\" + date glob.glob(directory + "./*.txt") so, if import glob workspace = "c:\\pathway\\totarget" date = time.strftime('%y_%m_%d') directory = workspace + "\\" + date listoffiles = glob.glob(directory + "./*.txt") print listoffiles i list of .txt files in target directory. far good. ================ python add header specified .txt file listoffiles = "c:\\pathwa