Aug-27-2021, 05:56 PM
If can write cross platform try to do that,
With platform should be able to get same info.
Can make a list and use
os.uname
only work on Linux.With platform should be able to get same info.
Can make a list and use
getattr
with those strings as attribute access for platform.import platform os_info = ['machine', 'version', 'system', 'release'] for item in os_info: print(getattr(platform, item)())
Output:AMD64
10.0.19041
Windows
10
On Linux Repl.itOutput:x86_64
#19~20.04.1-Ubuntu SMP Thu Aug 12 05:25:25 UTC 2021
Linux
5.11.0-1017-gcp