distro_features = "nfs smbfs wifi ppp alsa bluetooth ext2 irda pcmcia usbgadget usbhost pci" machine_features= "kernel26 usbhost ext2 pci pcmcia screen alsa irda acpi screen touchscreen" # does not work if distro_features.find("bluetooth") and not machine_features.find("bluetooth") and (machine_features.find("pcmcia") or machine_features.find("pci") or machine_features.find("usbhost")): print "add bt" # works if distro_features.find("bluetooth") and 0 > machine_features.find("bluetooth") and (0 < machine_features.find("pcmcia") or 0 < machine_features.find("pci") or 0 < machine_features.find("usbhost")): print "add bt"