简体   繁体   中英

Changing directory in python is giving a syntax error

I am following through a Python tutorial (though I have worked with python before) and I seem to be failing at a very simple instruction, namely changing the directory.

When I enter cd corepy , or indeed cd "corepy" I simply get a syntax error, even though the folder is very clearly there.

The Python tutorial is telling you where in your terminal to go to. You need to open a terminal and type that in. Or, if you want to know how to do that, it is very simple.

import os
os.chdir(corepy)

That's all it takes. I hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM