You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
--- |
|
title: Python |
|
date: 2020-11-13 20:40:15 |
|
updated: 2021-02-08 12:29:56 |
|
tags: |
|
categories: |
|
keywords: |
|
description: |
|
top_img: |
|
comments: |
|
cover: |
|
toc: |
|
toc_number: |
|
toc_style_simple: |
|
copyright: |
|
copyright_author: |
|
copyright_author_href: |
|
copyright_url: |
|
copyright_info: |
|
katex: true |
|
highlight_shrink: |
|
aside: |
|
--- |
|
|
|
### 一、python类的实例方法、静态方法和类方法区别及其应用场景 |
|
[https://blog.csdn.net/helloxiaozhe/article/details/79940321](https://blog.csdn.net/helloxiaozhe/article/details/79940321) |
|
### 二、python 中cls和self的区别 |
|
self:指的是一个具体实例的本身。如果在class中的某个方法加了@classmethod修饰器,那么这个方法不需要实例化也能直接被其他程序调用。 |
|
cls:表示这个类本身。 |
|
[https://blog.csdn.net/gtf215998315/article/details/106868558](https://blog.csdn.net/gtf215998315/article/details/106868558) |
|
### 三、list.extend()和list.append() |
|
>>> li = ['a', 'b', 'c'] |
|
>>> li.extend(['d', 'e', 'f']) |
|
>>> li ['a', 'b', 'c', 'd', 'e', 'f'] |
|
>>> len(li) |
|
6 |
|
>>> li[-1] 'f' >>> li = ['a', 'b', 'c'] |
|
>>> li.append(['d', 'e', 'f']) |
|
>>> li ['a', 'b', 'c', ['d', 'e', 'f']] |
|
>>> len(li) |
|
4 |
|
>>> li[-1] ['d', 'e', 'f'] |
|
|
|
|