# Apply a split function to all elements in a list # FileKeys = [element1, element2, element3 ABC, element4] FileKeys = [x.split(" ")[0] for x in FileKeys]