[問題] for 迴圈語法問題

看板Python作者 (fool)時間3年前 (2021/02/11 16:56), 編輯推噓1(101)
留言2則, 2人參與, 3年前最新討論串1/1
tokenizer_en = tfds.features.text.SubwordTextEncoder.build_from_corpus( (en.numpy() for pt, en in train_examples), target_vocab_size=2**13) 以上是自然語言處理的一段程式碼, 其中的 en.numpy() for pt, en in train_examples for迴圈前面為何還可以放入函式en.numpy()? 這種寫法是代表什麼意思,求解,謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.163.205.88 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1613033779.A.C89.html

02/11 17:15, 3年前 , 1F
google一下list comprehension
02/11 17:15, 1F

02/12 02:15, 3年前 , 2F
generator expression
02/12 02:15, 2F
文章代碼(AID): #1W9F4po9 (Python)