underscore method in python code example
Example 1: how to use underscore in python
# Ignore a value of specific location/index
for _ in range(10)
print ("Test")
# Ignore a value when unpacking
a,b,_,_ = my_method(var1)
Example 2: how to use underscore in python
class Prefix:
... def __init__(self):
... self.public = 10
... self._private = 12
>>> test = Prefix()
>>> test.public
10
>>> test._private
12