I am running Jupyter notebook on a server (python 3).
Want to see output of OS command (any OS command - this is just example):
output = os.system("pwd")
When I do print of it:
print (output)
Response is 0
.
How to get a simple output (like in CLI)?
Thanks.
Just found it on internet and wanted to post.
It needs to be:
print(os.popen('ls').read())
(or any other OS command).
This works fine.
import os
print(os.getcwd())
print(os.system("pwd"))
But this question is a duplicate: how to show current directory in ipython promp
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