I am very new to Python. I know that this has already been asked, and I apologise, but the difference in this new situation is that spaces between strings are not equal. I
only fill the filename to what you want
with open('filename') as infile, open('output', 'w') as outfile:
outfile.write(infile.read().replace(" ", ","))
with open('filename') as infile, open('output', 'w') as outfile:
outfile.write(infile.read().replace(",", " "))