Hi, I want to get installed Xen kernels & initrds in my computer using a python code. When I do a ls /boot I get the following results.

config-2.6.26-2-686
config-2.6.26-2-xen-686
grub
initrd.img-2.6.26-2-686
initrd.img-2.6.26-2-686.bak
initrd.img-2.6.26-2-xen-686
initrd.img-2.6.26-2-xen-686.bak
System.map-2.6.26-2-686
System.map-2.6.26-2-xen-686
vmlinuz-2.6.26-2-686
vmlinuz-2.6.26-2-xen-686
xen-3.2-1-i386.gz

and what I want is "vmlinuz-2.6.26-2-xen-686" & "initrd.img-2.6.26-2-xen-686". We can get the results using lot of string processing but I need a simple way to do this.
Thank You.

You can start with

import os
L = [x for x in os.listdir("/boot") if "-xen-" in x]
print(L)
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.