当前位置:网站首页>Class and object notes I
Class and object notes I
2022-07-27 00:20:00 【For a long time, the duck will become a goose】
List of articles
class
class Dog:
cute = True
def have_it(doggy):
print('eating')
Class instantiation
Call syntax : Instance name = Class name ()
significance : We have a specific example , It can call all properties and methods of its class .
class Dog:
cute = True # Here are the properties Dog hook cute yes True
def have_it(doggy): # Here's the method ( Functions in a class are called methods )
print('eating')
a = Dog() # Class instantiation
print(a.cute) # Print classes are properties
a.have_it() # Method of calling class
print(a)
Create a class —— Class instantiation —— Call the properties and methods of the class with an instance .
Create a class ~~class Class name :
Writing properties of a class
Write methods in classes ( function )
Class instantiation ~ Variable name = Class name ()
Instance name . attribute
Instance name . Method ()
边栏推荐
- PTA 7-4 small generation (DFS)
- Codeforces D. two divisors (number theory, linear sieve)
- Codeforces E. maximum subsequence value (greed + pigeon nest principle)
- Leetcode topic - array
- 11_ Weather case - monitoring properties
- Abstract classes and interfaces (sorting out some knowledge points)
- Chapter 2 develop user traffic interceptors
- Analysis of encoding and decoding of encode() and decode(), common encoding and why encode and decode are needed
- 在pycharm中部署yolov5报错问题
- 生成yolov5.wts文件出错
猜你喜欢

Deeplabcut uses 1

爬虫解析网页的find方法

LeetCode题目——数组篇

Leetcode topic - array

Recbole use 1

Practice of intelligent code reconstruction of Zhongyuan bank

Practice of data storage scheme in distributed system

Relationship between limit, continuity, partial derivative and total differential of multivariate function (learning notes)

Transpose convolution correlation

In depth interpretation of the investment logic of the consortium's participation in the privatization of Twitter
随机推荐
Identity server4 authorization successful page Jump encountered an error: exception: correlation failed Solution of unknown location
Convolutional neural network -- lenet (pytorch Implementation)
滑动窗口问题总结
Flink SQL (II) Kafka connector
实数范围内的求模(求余)运算:负数求余究竟怎么求
Deployment of yolov5 on Jetson nano deepstream
Knowledge distillation -- pytorch implementation
类与对象笔记一
[netding Cup 2018] Fakebook records
SSRF (server side request forgery) -- Principle & bypass & Defense
uni-app学习(二)
Share a regular expression
100. Same tree
DHCP, VLAN, NAT, large comprehensive experiment
Add an article ----- scanf usage
LeetCode——哈希表篇
"Could not load host key" error when xshell connects to the server
08 design of intelligent agricultural environmental monitoring system based on ZigBee
[literature reading] an investigation on hardware aware vision transformer scaling
Alexnet (pytoch Implementation)