Python判断多个列表中是否有重复的元素
seri = df_0.iloc[2].str.replace(r'/', '') # 公式
list_seri = seri.tolist() # 公式
list_spli = [ i.split('+') for i in list_seri] # +拆分
'''对公式的查找重复元素'''
list_spsp = [ j.replace('-', '') for i in list_spli for j in i] # 拆分
list_spdp = pd.Series(list_spsp).drop_duplicates().tolist()
for i in list_spdp:
for j in list_spdp:
if (i in j) and (i != j):
print(i,j)
标签:重复部分,tolist,spsp,spdp,关键词,list,replace,seri
From: https://blog.51cto.com/u_16055028/6317193