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()
'AMD64'
>>> platform.version()
'10.0.15063'
>>> platform.platform()
'Windows-10-10.0.15063-SP0'
>>> 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()
'Windows'
>>> platform.processor()
'Intel64 Family 6 Model 69 Stepping 1, GenuineIntel'
raja
Published on 26-Dec-2017 12:28:56
Advertisements