I want get the kernel serie, so 2.x only (2.6 or 2.4) info_kernel = platform.release() # get the kernel version info_kernel = '.'.join(info_kernel.split('.',2)[:2]) is there any way of get it in one line only? Thanks in advance!