cls

how to use gotoxy function instead of clrscr

落爺英雄遲暮 提交于 2019-12-02 09:28:44
问题 Doing first project and it's tetris; Now I'm doing the animation part, but I have a problem with clearing the screen, I've tried : void clrscr() { system("cls"); } It worked but it kept flashing the screen, is there a way using gotoxy function instead of clrscr on same purpose? I'm using windows console system 32, on visual studio 2008. 回答1: system("cls") executes a shell command to clear the screen. This is tremendously innefficient and definitievly not for game programming. Unfortunately

how to use gotoxy function instead of clrscr

*爱你&永不变心* 提交于 2019-12-02 06:18:15
Doing first project and it's tetris; Now I'm doing the animation part, but I have a problem with clearing the screen, I've tried : void clrscr() { system("cls"); } It worked but it kept flashing the screen, is there a way using gotoxy function instead of clrscr on same purpose? I'm using windows console system 32, on visual studio 2008. Christophe system("cls") executes a shell command to clear the screen. This is tremendously innefficient and definitievly not for game programming. Unfortunately screen I/O is system dependent. As you refer to "cls" and not to "clear", I guess you're working

二 .Flask配置文件

元气小坏坏 提交于 2019-12-02 03:53:59
一 .Flask配置文件 1.知识点巩固(通过字符串来获取类 类中的属性) 给一个字符串路径来获取 类和类里面的静态属性 app.py import importlib path="settings.Foo" # 给字符串找类 先截取 在通过模块 在通过反射 a,b=path.rsplit(".",maxsplit=1) # 加了maxsplit参数,发现在大量数据处理的时候 print(a,b) # settings Foo m=importlib.import_module(a) print(m) # <module 'settings' from 'J:\\django_flask\\myflask\\settings.py'> cls=getattr(m,b) print(cls) # <class 'settings.Foo'> # 如何找到这个类 print(dir(cls)) # 这个是获取到类里面的所有信息 # ['NAME', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__',

【深度学习】基于Pytorch的ResNet实现

橙三吉。 提交于 2019-12-01 23:39:51
目录 1. ResNet理论 2. pytorch实现 2.1 基础卷积 2.2 模块 2.3 使用ResNet模块进行迁移学习 1. ResNet理论 论文: https://arxiv.org/pdf/1512.03385.pdf 残差学习基本单元: 在ImageNet上的结果: 效果会随着模型层数的提升而下降,当更深的网络能够开始收敛时,就会出现降级问题:随着网络深度的增加,准确度变得饱和(这可能不足为奇),然后迅速降级。 ResNet模型: 2. pytorch实现 2.1 基础卷积 conv3$\times \(3 和conv1\) \times$1 基础模块 def conv3x3(in_channel, out_channel, stride=1, groups=1, dilation=1): return nn.Conv2d(in_channel, out_channel, kernel_size=3, stride=stride, padding=dilation, groups=groups, bias=False, dilation=dilation) def conv1x1(in_channel, out_channel, stride=1): return nn.Conv2d(in_channel, out_channel, kernel_size=1,

Python元类之由浅入深

故事扮演 提交于 2019-12-01 21:38:45
前言 ​ 元类属于python面向对象编程的深层次的魔法,非常重要,它使我们可以更好的掌控类从创建到消亡的整个生命周期过程。很多框架的源码中都使用到了元类。例如 Django Framework 中的 ORM engine. 白类 === 普通的自定义类 什么是元类 面向对象编程最重要的一句话: 一切皆对象 过去我们都 是这样创建类的: class Panda(object): hobby= "study python" def __init__(self, name, age): # initialize self.name = name self.age = age def __str__(self): # format return "My name=%s, age=%s"%(self.name, self.age) 然后再实例化获得 对象 suosuo = Panda("suosuo", 120) print(suosuo) # "My name=suosuo, age=120" print(type(suosuo)) # <class '__main__.Panda'> 都说了一切皆对象,那请问 类:<class '__main__.Panda'> 也该是一个对象吧! 答:没错,创建这个 Panda 类 的 类 我们称之为 元类 , 也就是 这个 Panda

详解python中的描述符

徘徊边缘 提交于 2019-12-01 19:25:55
描述符介绍 总所周知,python声明变量的时候,不需要指定类型。虽然现在有了注解,但这只是一个规范,在语法层面是无效的。比如: 这里我们定义了一个hello函数,我们要求name参数传入str类型的变量,然而最终我们传入的变量却是int类型,pycharm也很只能的提示我们需要传入str。但我就传入int,它能拿我怎么样吗?显然不能,这个程序是可以正常执行的。因此这个注解并没有在语法层面上限制你。 于是便出现了描述符,我们来看看描述符是干什么的。 class Descriptor: """ 一个类中,只要出现了__get__或者__set__方法,就被称之为描述符 """ def __get__(self, instance, owner): print("__get__", instance, owner) def __set__(self, instance, value): print("__set__", instance, value) class Cls: name = Descriptor() def __init__(self, name, age): self.name = name self.age = age """ 此时的name属性就被描述符代理了 """ c = Cls("satori", 16) # 输出内容 """ __set__ <__main_

config-2.6-pvops_x86_64

不羁岁月 提交于 2019-12-01 12:09:02
# # Automatically generated make config: don't edit # Linux kernel version: 2.6.32.41 # Tue Sep 6 09:42:18 2011 # CONFIG_64BIT=y # CONFIG_X86_32 is not set CONFIG_X86_64=y CONFIG_X86=y CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" CONFIG_GENERIC_TIME=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_HAVE_LATENCYTOP_SUPPORT=y CONFIG_MMU=y CONFIG_ZONE_DMA=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_IOMAP=y CONFIG

JavaScript初识之DOM操作(二)

怎甘沉沦 提交于 2019-12-01 10:14:40
获取标签中的值 // 获取用户的输入值 // 选择,输入文本,文件都算是用户输入 // input , select , textarea 只能用.value获取值 .getAttribute('value')无法获取到值 CLASS操作 先定位到一个标签 className // 获取所有样式类名(字符串) classList // 就可以得到它的所有类 classList.remove(cls) // 删除指定类 classList.add(cls) // 添加类 classList.contains(cls) // 存在返回true,否则返回false classList.toggle(cls) // 存在就删除,否则添加 操作CSS样式 // 加一个style 就好了,后面的东西就靠点一下就好了 // 如果后面是要加下划线的,我们只需要把下划线去掉,后面的字母大写就完事了 来源: https://www.cnblogs.com/pscly/p/11679683.html

Python基础 5.类

匆匆过客 提交于 2019-12-01 09:14:58
5.1 类定义和方法 1 .类的定义: 类 是一个独立存放变量(属性/方法)的空间 class 类名: pass​ 实例名 = 类名() 2.运算符“.” 调用类的属性或方法 实例可以访问类的属性类不可以访问实例的属性实例也是一个独立存放变量的空间实例和实例没有关联 本身没有这个属性 就会去类中找 3.私有属性 在python中有两私有属性,分别是在属性前加 一个下换线(_) 和两个下划线(__) 一个下滑线外部可以直接访问,二个下划线外部不可以直接访问 4.方法 就是封装在类里的一种特殊的函数 5.“实例方法” self代表实例本身 表示的是“实例”的行为给实例用的,和函数的传参一样,只是会先传一个自身的实例self,​方法总是定义在类中的,但是却叫“实例方法”,因为它表示该类所有实例所共有的行为 class persson(object): def eat(self): print('{}正在吃烦'.format(self.name)) return 100​nanbei=persson()nanbei.name='南北'a=nanbei.eat()print(a) 5.2 初始化和析构 (dir查看属性与方法) Python中有很多以双下划线开头且以双下划线结尾的固定方法。他们会在特定的时机被触发执行。 init 就是其中之一,它会在实例化之后自动被调用。以完成实例的初始化。

day22 学习小结

江枫思渺然 提交于 2019-12-01 07:28:05
目录 classmethod classmethod是什么? 用classmethod绑定方法的目的 类的绑定方法的特殊之处 (对象的绑定方法的特殊之处) 如何使用classmethod staticmethod staticmethod是什么? 为什么要使用staticmethod? 如何使用staticmethod isinstance issubclass 反射 什么是反射 反射的使用 魔法方法 单例模式 classmethod classmethod是什么? classmethod是一个装饰器,可以用来装饰类内部的方法,使该方法绑定给类来使用。 用classmethod绑定方法的目的 类的绑定方法的特殊之处 classmethod使被装饰的方法只能由类来调用,而且该方法会将类当做第一个参数传给该方法。这种方法被称为 类的绑定方法 。 (对象的绑定方法的特殊之处) 由对象来调用,会将对象当做第一个参数传给该方法。 如何使用classmethod 和正常装饰器一样,在需要被装饰的函数上方@classmethod就可以了。 staticmethod staticmethod是什么? staticmethod是一个装饰器,可以装饰给 类内部 的方法,使该方法既不绑定给对象,也不绑定给类。 为什么要使用staticmethod? 在类内部使用@staticmethod