Strange path separators on Windows

前端 未结 6 913
臣服心动
臣服心动 2020-12-18 07:44

I an running this code:

#!/usr/bin/python      coding=utf8
#  test.py = to demo fault
def loadFile(path):
    f = open(path,\'r\')
    text = f.read()
    re         


        
6条回答
  •  爱一瞬间的悲伤
    2020-12-18 08:27

    In addition to using a raw string (prefix string with the r character), the os.path module may be helpful to automatically provide OS-correct slashes when building a pathname.

提交回复
热议问题