上一页 1 2 3 4 5 6 7 ··· 31 下一页
摘要: 一、复习 1、什么是多态 2、复习上一节课内容 class Triangle: """ 三角形类 """ def __init__(self, width, height): self.width = width self.height = height def get_area(self): area = ... 阅读全文
posted @ 2019-11-17 15:19 绿色的麦田 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 一、复习 1、什么是魔法方法? 2、什么是类的初始化函数? 二、什么是self 使用一个类可以创建多个对象实例,例如: ball1 = Ball(“red”, “small”, “down”) ball2 = Ball(“red”, “medium”, “up”) 调用其中一个实例的方法时,像这样:ball1.bounce() 方法必须知道是哪个实例调用它, self参数会告诉方法哪个... 阅读全文
posted @ 2019-11-16 23:35 绿色的麦田 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 作业: 1、编写一个Dog类,并生成对象dog,属性包含颜色,大小,重量,可以汪汪叫,摇尾巴,跑 # -*- coding: utf-8 -*- class Dog: def __init__(self, color, size, weight): self.color = color self.size = size self.weig... 阅读全文
posted @ 2019-11-16 19:25 绿色的麦田 阅读(217) 评论(1) 推荐(0) 编辑
摘要: 一、复习 1、什么是对象 2、什么是类 3、什么是属性 4、什么是方法 5、创建一个dog类,dog的属性有颜色,方法有汪汪叫 随堂练习: class Dog: def __init__(self, color): self.color = color def wangwang(self): print("Dog wangwang!") do... 阅读全文
posted @ 2019-11-10 09:10 绿色的麦田 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 一、复习 1、函数的创建 1) def关键字 2) 函数名及后面跟随的括号 3)冒号加上函数体 2、函数的调用 函数名及后面跟随的括号 3、带一个,二个,三个参数的函数及调用 二、列表 family = [‘Mom’, ‘Dad’, ‘Baby’] nums = [1, 2, 3, 4] 列表:一堆数据存在一起,放在某种组或者集合中 1、创建列表: a = list() b = [1, 2, ... 阅读全文
posted @ 2019-11-02 23:14 绿色的麦田 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 一、函数 1、函数定义: 可以完成某个工作的代码块。这是可以用来构建更大程序的一个小部分。 2、创建或定义函数要使用def关键字 3、创建一个函数 1) def 关键字 2)函数名及后面跟随的括号 3)冒号与for循环,while循环,if语句中一样 提醒:函数没被调用前不是主程序的一部分。 4、调用函数 print_nums() 5、向函数传递参数 1)一个参数 def prin... 阅读全文
posted @ 2019-10-27 09:10 绿色的麦田 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 一、复习 1、easygui 信息提示对话框 2、easygui 是否对话框 二、easygui其它组件 1、选择对话框:choicebox(msg, title, choices) import easygui as g msg = "输入你喜欢的颜色" title = "游戏互动" choices = ["红色", "绿色", "蓝色", "青色"] choice = g.choicebo... 阅读全文
posted @ 2019-10-19 18:52 绿色的麦田 阅读(412) 评论(0) 推荐(0) 编辑
摘要: 一、复习之前的两个练习,巩固计数循环和条件循环 1、系统生成一个随机数1到5,然后让用户的猜测,若猜对了,提示恭喜你,猜对了,否则提示,对不起,你猜错了(提示,1到5的随机数为:secret = random.randint(1, 5)),此行代码之前需先引入随机数模块import random 2、将以下乘法口诀表代码改为while循环 for i in range(1, 9+1): ... 阅读全文
posted @ 2019-10-13 07:23 绿色的麦田 阅读(552) 评论(0) 推荐(0) 编辑
摘要: conf = default_config()deep_update(user_config(), conf)deep_update(project_config(), conf) 三种不同级别的配置,第一个是默认配置,第二个是用户级配置,第三个是工程级配置(这种方法看起来和php的配置逻辑相似) 第四个是命令行若存在config_path选项,则使用config_path提供的配置 get_tr... 阅读全文
posted @ 2019-10-08 22:36 绿色的麦田 阅读(351) 评论(0) 推荐(0) 编辑
摘要: 在文件C:\work\python\rqalpha\rqalpha\utils\config.py找文件:C:\work\python\rqalpha\rqalpha\config.yml则通过下面代码即可找到config.yml的绝对路径default_config_path = os.path.join(os.path.dirname(__file__), '..', 'config.yml'... 阅读全文
posted @ 2019-10-08 22:04 绿色的麦田 阅读(307) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 31 下一页