我可以知道如何提出我的預期結果。我正在使用「if」陳述掙扎一個小時,但沒有發生任何事情。Python:從多個詞典列表中篩選空字符串
books = [{'title':'Angels and Demons'},{'title':''},{'title':'If'},{'title':'Eden'}]
authors = [{'author':'Dan Brown'},{'author':'Veronica Roth'},{'author':''},{'author':'James Rollins'}]
for i, book in enumerate(books):
print(book, authors[i])
expected result:
({'title': 'Angels and Demons'}, {'author': 'Dan Brown'})
({'title': 'Eden'}, {'author': 'James Rollins'})
您的代碼甚至沒有一個if語句。如果你沒有正確解釋,我們如何幫助你?詳情請閱讀https://stackoverflow.com/help/how-to-ask – Mikkel