Skip to content

Instantly share code, notes, and snippets.

@adtraub
Last active September 13, 2016 12:28
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 adtraub/e714e8ad94d0a08aca3d to your computer and use it in GitHub Desktop.
Save adtraub/e714e8ad94d0a08aca3d to your computer and use it in GitHub Desktop.
Simple Python Script to remove new lines from a file and save the output to a new file - not meant to be particularly robust
def removeNewLines(inputFileName, outputFileName):
with open(outputFileName, 'w') as outFile:
with open(inputFileName, 'r') as inFile:
outFile.write(inFile.read().replace('\n', ''))
if __name__ == "__main__":
inputFileName = input("input file name: ")
outputFileName = input("output file name: ")
removeNewLines(inputFileName, outputFileName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment