Does anyone know how to use the subprocess.call to assign the ouput of a command to a string.

At the moment it only assigns the return code ??

>>> hostname = call(["hostname", "-d"])
lon3.corp.rackspace.com
>>> print hostname
0

Thanks,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.