Skip to content

Instantly share code, notes, and snippets.

@kaushik94
Created December 15, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushik94/f3d21d74f8e3867a5366ac100ae96f14 to your computer and use it in GitHub Desktop.
Save kaushik94/f3d21d74f8e3867a5366ac100ae96f14 to your computer and use it in GitHub Desktop.
__author__ = 'kvaranasi'
import csv
import os
import re
rootdir = os.getcwd()
rootdir += '/lib/fathead'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
if file == 'output.txt':
filepath = subdir + os.sep + file
if filepath.endswith("output.txt"):
example_rows=[]
print (filepath)
with open(filepath) as f:
content = f.readlines()
for each in content:
example_rows.append(each.replace(r'\t', ' '))
with open(filepath+'_1', 'w+') as f:
for each in example_rows:
f.write(each)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment