How do I escape forward slashes in python, so that open() sees my file as a filename to write, instead of a filepath to read?

前端 未结 3 1157
野性不改
野性不改 2021-02-13 04:46

Let me preface this by saying I\'m not exactly sure what is happening with my code; I\'m fairly new to programming.

I\'ve been working on creating an i

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 05:47

    On Unix/Mac OS, for the middle slashes, you can use : which will convert to / when viewed, but trigger the subfolders that / does.

    site/sitename/class/final-code -> final-code file in a class folder in a sitename folder in a site folder in the current folder site:sitename:class:final-code -> site/sitename/class/final-code file in the current folder.

提交回复
热议问题