我有一個問題,我一直想要問一下現在。我有一些代碼,我試圖檢查每個項目的引用列表朝向另一個列表,所有這些INLINE。例如:內聯循環Python。檢查列表中的每個成員到另一個列表內嵌
if int(word[:-1])>=1 and int(word[:-1])<=31 and for word in LIST1, word in LIST2:
day = word[:-1]
更具體地,這是數據刮程序來篩選出的數據的各種領域,例如日期和月份的一部分。
months = ["January","February",etc......]
days = ["monday,","tuesday,","wednesday,","thursday,","friday,","saturday,","sunday,"]
if word.lower() in days and For i in line.split(), months.contains(i)
因此,例如,在list1中,我每週都有一天。如果LIST2包含一週中的任何一天(不是全部),則這將評估爲真。有誰知道一個光滑的方式來做到這一點?謝謝。
能否請您解釋與樣品的輸入和預期輸出你的問題? – thefourtheye