【问题标题】:Jupyter note book path not found找不到 Jupyter 笔记本路径
【发布时间】:2021-02-09 15:04:43
【问题描述】:
  1. 我试图找到该文件。向前和向后都使用了我也使用了 1 和 2 撇号 - 没有任何改变
  2. 这是我得到的错误

【问题讨论】:

    标签: python compiler-errors jupyter-notebook coding-style filepath


    【解决方案1】:

    Windows 有点棘手。这只是一种预感,但也许可以尝试:

    path = "C:\\Users\\BarbieA\\.... " 
    

    Windows 路径由 \ 分隔,但由于它用于转义特殊字符,因此您也需要对其进行转义,因此它变为 \\

    【讨论】:

      【解决方案2】:

      是的。我建议使用 pathlib 让您的生活更轻松,因为有时手写时空格和特殊符号可能会令人困惑。

      from pathlib import PureWindowsPath
      file = PureWindowsPath(r"C:\Users\Barbie..")
      open(file)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-04-07
        • 2020-10-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-03-23
        • 2021-03-04
        相关资源
        最近更新 更多