嗨,伙計們,我剛開始編程,我正在努力做到這一點。
A = [['1','Jack','33'], ['2','Maria','23'], ['3','Christian','9'] ]
B = [['1','Jack','33'], ['2','Maria','23'], ['3','Christian','9'], ['4','Denis','45'] ]
我想檢查陣列B[0]并列印出“4 Denis 45”
uj5u.com熱心網友回復:
我不確定你想要什么。是這個嗎:
A_ids = [item[0] for item in A]
for lst in B:
if lst[0] not in A_ids:
# You can do whatever you want to do with lst at this point
print(" ".join(lst))
輸出:
4 Denis 45
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/456422.html
