0

path="C:\Users\Manav\Desktop\txtfile.txt" f = open(path,mode='r') The file (txtfile.txt) is on the desktop. I have tried a few things now but still the error persists.I use jetbeans pycharm. Used double '' too. Can anyone help me out?

Manav
  • 1
  • 2
  • 1
    Close to a typo: a backslash is a quoting character so it must be doubled: `C:\\Users\\Manav\\Des...` – Serge Ballesta Jun 29 '20 at 08:50
  • Note that ``\t`` is a tab character. It is not the two characters ``\`` and ``t``. – MisterMiyagi Jun 29 '20 at 08:51
  • path="C:\\Users\\Manav\\Desktop\\txtfile.txt" f = open(path,mode='r') Tried this too Name of the file is txtfile.txt. . – Manav Jun 29 '20 at 09:06
  • If the linked question does not solve your problem, please [edit] your question to provide more details. Does ``os.path.exists(path)`` return true? Do you have permission to read the file? Also, consider to use this opportunity to properly format the code shown. See the [mcve] and [ask] page for details how to best help us help you. – MisterMiyagi Jun 29 '20 at 09:30
  • os.path.exists(path) returns false. I'll edit the question. – Manav Jun 29 '20 at 09:51

0 Answers0