作者stayfool (fool)
看板Python
標題[問題] for 迴圈語法問題
時間Thu Feb 11 16:56:17 2021
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
推 museangel: google一下list comprehension 02/11 17:15
→ kwanza: generator expression 02/12 02:15