Python file open() in Enthought Canopy fails with: “IOError No such file or directory”

后端 未结 2 386
时光说笑
时光说笑 2020-12-17 01:13

I\'m running code under Enthought Canopy to open and read a file. It keeps telling me IOError.

But I am pretty sure the text file name is right and it is in the same

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 01:19

    It is also possible to open a txt file when giving a complete path in parentheses, to change all \ with /

    from:

    text=open('C:\Users\Korisnik\Desktop\abeceda.txt')
    

    to:

    text=open('C:/Users/Korisnik/Desktop/abeceda.txt')
    

提交回复
热议问题