Skip to content

Instantly share code, notes, and snippets.

@dvigne
Created April 17, 2017 01:38
Show Gist options
  • Save dvigne/2e1281729aec5566b15b6df443a4f510 to your computer and use it in GitHub Desktop.
Save dvigne/2e1281729aec5566b15b6df443a4f510 to your computer and use it in GitHub Desktop.
Convert All Whitespaces To CSV
import string
import sys
inputFile = open(sys.argv[1], 'r');
fileContents = inputFile.read();
fileContents = ','.join(fileContents.split());
print("Converted CSV: \n" + fileContents)
outputFile = open((inputFile.name).replace('.', '') + ".csv", 'w')
outputFile.write(fileContents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment