How to get a file system information using Python?

PythonServer Side ProgrammingProgramming

The os module has the uname function to get information about the os & version:

>>> import os
>>> os.uname()

But this can only be used for recent *NIX flavours. To get a more cross platform solution, use the platform module:

>>> import platform
>>> import platform
>>> platform.machine()
>>> platform.version()
>>> platform.platform()
>>> platform.uname()
uname_result(system='Windows', node='DESKTOP-N0VDLO7', release='10', version='10.0.15063', machine='AMD64', processor='Intel64 Family 6 Model 69 Stepping 1, GenuineIntel')
>>> platform.system()
>>> platform.processor()
'Intel64 Family 6 Model 69 Stepping 1, GenuineIntel'
Published on 26-Dec-2017 12:28:56