سؤال

What is the equivalent perl and python code for unix command mdb hostname This command gives all the details of the host(machine name)?

One way is to run this unix command embedded with perl/python script and get the details, but is there any existing module that provides this functionality?

هل كانت مفيدة؟

المحلول

You can always call the mdb command in Python like this:

import subprocess

mdbOutput = subprocess.check_output([ 'mdb', 'hostname' ])

Then you have the output of mdb in the variable mdbOutput and can parse it yourself. But since I have no idea what it looks like (you should post that), I have no clue how to go on now.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top