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
相关文章
相关标签/搜索