Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何在 Python 中设置当前工作目录?
如何C:\>改用F:\>Python
C:\>
F:\>
我试过了
import os os.chdir("F:")
但出现错误。
您需要额外的反斜杠:
import os os.chdir("F:\\")