i want to see some info and get info about my os with python as in my tutorial but actually can't run this code:
import os
F = os.popen('dir')
and this :
F.readline()
' Volume in drive C has no label.\n'
F = os.popen('dir') # Read by sized blocks
F.read(50)
' Volume in drive C has no label.\n Volume Serial Nu'
os.popen('dir').readlines()[0] # Read all lines: index
' Volume in drive C has no label.\n'
os.popen('dir').read()[:50] # Read all at once: slice
' Volume in drive C has no label.\n Volume Serial Nu'
for line in os.popen('dir'): # File line iterator loop
... print(line.rstrip())
this is the the error for the first on terminal, (on IDLE it return just an '
f = open('dir') Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: 'dir'
I know on mac it should be different but how? to get the same result using macOS sierra.