I have a set of numbers (NDC - drug numbers) that have a - in them. I am trying to read the file, remove the - and write the numbers to a new file.
You can do it easily with a shell script which would be must faster than a python implementation. Unless you have something more with the script, you should go with the shell script version.
However, with Python it would be:
with open('c:\NDCHypen.txt', 'r') as infile, open('c:\NDCOnly.txt', 'w') as outfile:
temp = infile.read().replace("-", "")
outfile.write(temp)