我有以下嵌套列表,我想删除My Profile之后的所有项目(包括My Profile)。
my_lst = [['John C, CEO & Co-Funder, ABC company','Eric P, CFO, QWE company','My Profile','Herber W, CTO, PPP company'],
['Eli S, AVP, ACV Company', 'My Profile','Brian M, Analyst, LPL company'],
['Diana F, Managing Director, MS company','Alan X, Associate, JPM company','My Profile', 'Jame R, Manager, AL company']]
我尝试了编码[[i for i in nested if i != 'My Profile'] for nested in my_lst],但只能从每个列表中删除我的个人资料。
我的预期输出:
[['John C, CEO & Co-Funder, ABC company','Eric P, CFO, QWE company'],
['Eli S, AVP, ACV Company'],
['Diana F, Managing Director, MS company','Alan X, Associate, JPM company']]
在此先感谢您的帮助!