I have tried to use list comprehension but I just can't figure out how to structure it for my particular issue. I have a nested list. The sublist is at the end:
['x', '', 'x', 'y', 'x', Suite 111', 'Prairie Village', 'KS', '\t66207', '5200 W. 94th Terrace, Suite 111', 'Prairie Village', 'KS', '\t66207', 'x', 'y', 'x', 'y', 'Kansas City', 'SLBE', 'This company provides Framing and Finish Carpentry installation services, Drywall & Acoustical Ceilings installation services and Construction Management services for Commercial & Institutional Buildings construction projects. . Metal Studs - Trim - Cabinetry - Carpenters - Doors - Windows - Hardware - Sheet Rock - Suspended ceilings - Construction Administration - Project Management - Tenant Finish - Interior Finish', '', ['236220 - Construction management, commercial and institutional building', '236220 - Project Management (Inactive effective 02-12-2020)', '238130 - Framing contractors', '238130 - Stud wall (e.g., wood, steel) installation', '238130 - Carpentry', '238310 - Acoustical ceiling tile and panel installation', '238310 - Ceiling tile installation', '238310 - Drywall contractors', '238310 - Drywall hanging', '238350 - Cabinetry work performed at the construction site', '238350 - Door and window, prefabricated, installation', '238350 - Trim and finish carpentry contractors', '238350 - Finish Carpentry Contractors']]
I would like to go through and remove the entire element from the list which contains the substring 'Inactive', however I cannot figure out how. I'm thinking that I could use regex but I'm just confused on how I would go about doing this.
My desired outcome is:
['x', '', 'x', 'y', 'x', Suite 111', 'Prairie Village', 'KS', '\t66207', '5200 W. 94th Terrace, Suite 111', 'Prairie Village', 'KS', '\t66207', 'x', 'y', 'x', 'y', 'Kansas City', 'SLBE', 'This company provides Framing and Finish Carpentry installation services, Drywall & Acoustical Ceilings installation services and Construction Management services for Commercial & Institutional Buildings construction projects. . Metal Studs - Trim - Cabinetry - Carpenters - Doors - Windows - Hardware - Sheet Rock - Suspended ceilings - Construction Administration - Project Management - Tenant Finish - Interior Finish', '', ['236220 - Construction management, commercial and institutional building', '238130 - Framing contractors', '238130 - Stud wall (e.g., wood, steel) installation', '238130 - Carpentry', '238310 - Acoustical ceiling tile and panel installation', '238310 - Ceiling tile installation', '238310 - Drywall contractors', '238310 - Drywall hanging', '238350 - Cabinetry work performed at the construction site', '238350 - Door and window, prefabricated, installation', '238350 - Trim and finish carpentry contractors', '238350 - Finish Carpentry Contractors']]
Would somebody please help me?