Is there any Python code to get the list of packages installed on Ubuntu along with the version of the package? I have seen Python code at Generating list of manually installed packages and querying individual packages. But that doesn't have the listing of version ID. Can anyone know how to get the version of the installed packages?
Scan and get the packages installed on Ubuntu along with the version
apt;package management
I'm not sure if there is existing code for that. But you can look at file /var/lib/dpkg/status. All information about installed packages is stored in this file.To write code that will parse this file is pretty easy even in case you're not great in python.