Python 3.2.2 open('C:\file.txt') doesn't work

后端 未结 1 831
夕颜
夕颜 2021-01-19 09:34


Admittedly, I am a novice; however, (I think) I did what the tutorial said (for the version I installed) and I can\'t get Python to read a file. Others have had problem

1条回答
  •  野的像风
    2021-01-19 10:20

    \ is an escape character. Try open(r"C:\try\in0.txt") or open("C:\\try\\in0.txt").

    0 讨论(0)
提交回复
热议问题