Trim output result when searching python packages

Avoids a bug with older cmake. Older cmake cannot  read from CMakeCache.txt file with an unexpected
'\n' value.