-1

In Python notebook on Azure Databricks I am running the following two commands:

import os
os.system('ls') 

it returns:

Out[1]: 0

then I run magic command

%ls

and it returns list of files and folders

Why os.system('ls') does not return the same?

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216
user1700890
  • 6,206
  • 15
  • 77
  • 160
  • 3
    Read the manual for `os.system()`. It doesn't return text, only an exit status. If there's text printed, that's because the subprocess wrote it directly to the same TTY you're reading; but it bypasses the Python runtime. – Charles Duffy May 05 '22 at 18:15

0 Answers0