Created
December 15, 2016 17:24
-
-
Save kaushik94/f3d21d74f8e3867a5366ac100ae96f14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__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