I'm trying to get the output of pwd:
#!python
import os
pwd = os.system("pwd")
print (pwd)
it prints 0 which is the successful exit status instead the path. How can i get the path instead?
Running system commands is better done with subprocess, but if you are using os already, why not just do
pwd = os.getcwd()
os.getcwd() is available on Windows and Unix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With