List all installed packages in Ubuntu using python
Question: I am using python 2.7. How do I get a list of all installed packages in python
on Ubuntu


Answer: You need to import `subprocess` module.

    
    
    >>> import subprocess
    >>> subprocess.call('dpkg -l', shell=True)
    

