Skip to content

Instantly share code, notes, and snippets.

@mayhewsw
Created August 14, 2015 22:06
Show Gist options
  • Save mayhewsw/ec3a74f7821bf396b83c to your computer and use it in GitHub Desktop.
Save mayhewsw/ec3a74f7821bf396b83c to your computer and use it in GitHub Desktop.
import sys
if len(sys.argv) != 2:
print "Usage: python nospaces.py <inputfile>"
exit()
infile = sys.argv[1]
print "Removing the spaces from " + infile + "..."
outfile = "nospaces.txt"
out = open(outfile, "w")
with open(infile) as f:
for line in f:
out.write("\t".join(map(lambda s: s.strip(), line.split("\t"))) + "\n")
out.close()
print "Resulting file is called " + outfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment