The file path is the source of your problem -
Either prefix the path with
PS IDLE is one of the worst Python environments, I would recommend switching to Spyder or Jupyter
C:\location\output.dat
. Backslash is an escape symbol, giving a special meaning to to following character, e.g. \n
.Either prefix the path with
r
to make it a raw string - r'C:\location\output.dat'
, or use double backslash. Replacing backslash with a slash will work too.PS IDLE is one of the worst Python environments, I would recommend switching to Spyder or Jupyter
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.