Can the cd command in Python be used to change directories like in the terminal?

22 Replies, 1849 Views

Yo! So, the cd command Python thing is kinda different from the terminal. In Python, you gotta use `os.chdir()` to change directories. It’s not exactly the same vibe as just typing `cd` in the terminal, but it does the job.

If you’re looking for something closer to terminal commands, check out the `subprocess` module. You can run shell commands directly from Python using that.

Also, this site might help: [Real Python](https://realpython.com). They’ve got some solid tutorials on this stuff.

Messages In This Thread



Users browsing this thread: 1 Guest(s)