【发布时间】:2021-02-09 15:04:43
【问题描述】:
【问题讨论】:
标签: python compiler-errors jupyter-notebook coding-style filepath
【问题讨论】:
标签: python compiler-errors jupyter-notebook coding-style filepath
Windows 有点棘手。这只是一种预感,但也许可以尝试:
path = "C:\\Users\\BarbieA\\.... "
Windows 路径由 \ 分隔,但由于它用于转义特殊字符,因此您也需要对其进行转义,因此它变为 \\
【讨论】:
是的。我建议使用 pathlib 让您的生活更轻松,因为有时手写时空格和特殊符号可能会令人困惑。
from pathlib import PureWindowsPath
file = PureWindowsPath(r"C:\Users\Barbie..")
open(file)
【讨论】: