Python parameter constructor example details
- 2020-06-01 10:18:59
- OfStack
This post focuses on how to construct a parameter constructor in Python3
Examples are as follows:
class MyOdlHttp:
username = ''
password = ''
def __init__(self, username, password):
self.username = username
self.password = password
print(username)
my_old_http = MyOdlHttp('admin', '123')
The output is no doubt admin\n 123\n
You can see from the sample that it is mainly done by copying the init function.
Thank you for reading, I hope to help you, thank you for your support of this site!