GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python/Article/PythonBasis/python8/4.md at master · teract/Python

Expand file tree

/

4.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
32 lines (13 loc) · 897 Bytes
/

4.md

Copy path

File metadata and controls

32 lines (13 loc) · 897 Bytes
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

四、修改和增加类属性

1、从内部增加和修改类属性

来,我们先来温习一下类的结构。

看着这个结构,提一个问题,如何修改类属性,也就是类里面的变量?

从类结构来看,我们可以猜测,从类方法来修改,也就是从类内部来修改和增加类属性。

看下具体的实例:

这里还是强调一下,例子还是要自己多写,不要只看,自己运行, 看效果。多想。

2、从外部增加和修改类属性

我们刚刚看了通过类方法来修改类的属性,这时我们看下从外部如何修改和增加类属性。

例子如下:

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.