资讯

If you know how to use variables in Python, this works similarly: except instead of storing one piece of data as an integer, you are storing custom information about an object you conceived.
Dataclasses, introduced in Python 3.7 (and backported to Python 3.6), provide a handy, less verbose way to create classes.
By using classes, you’re ensuring that methods are only used on one set of data. This adds to the security of the code because you’re less likely to use functions where they don’t belong.