Python中單個下劃線「 _」變量的用途是什麼? - What is the purpose of the single underscore 「_」 variable in Python?

問題:

What is the meaning of _ after for in this code? 這段代碼中_ after for的含義是什麼? this

if tbh.bag:
   n = 0
   for _ in tbh.bag.atom_set():
      n += 1

解決方案:

參考一: https://stackoom.com/question/Oj51/Python中單個下劃線-變量的用途是什麼
參考二: https://oldbug.net/q/Oj51/What-is-the-purpose-of-the-single-underscore-variable-in-Python
相關文章
相關標籤/搜索