12 2017 档案
摘要:JavaScript 基础学习1 知识预览JavaScript概述二 JavaScript的基础三 JavaScript的对象BOM对象DOM对象实例练习js扩展 JavaScript概述 JavaScript的历史 1992年Nombas开发出C-minus-minus(C--)的嵌入式脚本语言(
阅读全文
摘要:1、web服务本质 import socket def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost',8081)) sock.listen(5) while True:
阅读全文
摘要:1、CSS 语法 1.1、CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明。 selector { property: value; property: value; ... property: value } 例如: h1 {color:red; font-size:14px;} 2、
阅读全文
摘要:Cpython解释器支持的进程与线程 阅读目录 一 python并发编程之多进程 1.1 multiprocessing模块介绍 multiprocessing模块的功能众多:支持子进程、通信和共享数据、执行不同形式的同步,提供了Process、Queue、Pipe、Lock等组件。 1.2 Pro
阅读全文
摘要:进程与线程理论基础 1、背景知识 理论基础: 一 操作系统的作用: 二 多道技术: 2、进程 2.1 什么是进程 2.2 进程与程序的区别 2.3 并发与并行 2.4 同步与异步 同步执行:一个进程在执行某个任务时,另外一个进程必须等待其执行完毕,才能继续执行 异步执行:一个进程在执行某个任务时,另
阅读全文
摘要:目录Day8-Python socket 11、Socket 11.1、socket和file的区别: 11.2、WEB服务应用: 21.3、更多功能 21.4、socket方法: 41.5、 服务端 51.6、客户端 62、实例 63、IO多路复用 73.1、Linux IO复用 73.2、Pyt
阅读全文
摘要:Day7-面向对象基础 1一、isinstance(obj, cls) 1二、issubclass(sub, super) 1三、异常处理 11、异常基础 12、异常种类 23、异常其他结构 54、主动触发异常 55、自定义异常 56、断言 6四、反射 6类也是对象 12模块也是对象 12五、设计模
阅读全文
摘要:1、字段 12、方法 43、属性 63.1、属性的基本使用 73.2、实例:对于主机列表 83.3、属性的两种定义方式 94、对于类的成员而言都有两种形式: 144.1、私有成员和公有成员的访问限制不同: 155、Python的类成员也是如此,存在着一些具有特殊含义的成员,详情如下: 175.1、
阅读全文
摘要:Python 之路 Day6 - 常用模块学习 本节大纲: 模块,用一砣代码实现了某个功能的代码集合。 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合。而对于一个复杂的功能来,可能需要多个函数才能完成(函数又可以在不同的.py文件中)
阅读全文
摘要:目录Day-Python-迭代器&生成器 21、生成器 21.1、生成器引入 21.2、生成器作用 31.3、创建生成器的方法 31.4、用函数来实现复杂的生成器 51.5、把函数变成生成器通过yield来实现 61.6、函数定义中包含yield关键字==generator生成器 81.7、通过yi
阅读全文
摘要:1、字典 1.1、为什么有字典: 有个需求,存所有人的信息 这时候列表就不能轻易的表示完全names = ['stone','liang'] 1.2、元组: 定义符号()t = (1,2,3)tuple 是元组的意思列表与元组不一样的地方是它 元组不可以修改元组其实跟列表差不多,也是存一组数,只不是
阅读全文
摘要:1、函数 1.1、集合 主要作用: 2. 元组 只读列表,只有count, index 2 个方法 作用:如果一些数据不想被人修改, 可以存成元组,比如身份证列表 3. 字典 key-value对 为什么会查询速度会快呢?因为他是hash类型的,那什么是hash呢? 哈希算法将任意长度的二进制值映射
阅读全文
摘要:1.数据类型 1.1 变量引出数据类型 变量:用来记录状态变量值的变化就是状态的变化,程序运行的本质就是来处理一系列的变化 1.2 五大基本数据类型: 数字 字符串 列表 元组 字典 1.2.1 数字 整型 长整型 浮点 布尔 复数 内置函数是:int()int(a,base=b)a是变量或者是"a
阅读全文
摘要:1 Python介绍 1.1 Python 是一门什么样的语言? python是一门动态解释性的强类型定义语言。 编译型的特点:可一致性差,运行速度快。 解释型的特点:边执行边解释,速度慢 1.2 Python 优缺点 优点 Python的定位是“优雅”、“明确”、“简单”,所以Python程序看上
阅读全文
摘要:reduce()函数也是Python内置的一个高阶函数。 reduce()函数接收的参数和 map()类似,一个函数 f,一个list,但行为和 map()不同,reduce()传入的函数 f 必须接收两个参数,reduce()对list的每个元素反复调用函数f,并返回最终结果值。 例如,编写一个f
阅读全文
摘要:return 语句就是讲结果返回到调用的地方,并把程序的控制权一起返回 程序运行到所遇到的第一个return即返回(退出def块),不会再运行第二个return。 要返回两个数值,写成一行即可: 但是也并不意味着一个函数体中只能有一个return 语句,例如: 函数没有 return,默认 retu
阅读全文
摘要:1.先用 for 循环取。 12345678910
阅读全文
摘要:格式:\033[显示方式;前景色;背景色m数值表示的参数含义:显示方式: 0(默认值)、1(高亮)、22(非粗体)、4(下划线)、24(非下划线)、 5(闪烁)、25(非闪烁)、7(反显)、27(非反显)前景色: 30(黑色)、31(红色)、32(绿色)、 33(黄色)、34(蓝色)、35(洋 红)、36(青色)、37(白色)背景色: 40(黑色)、41(红色)、42(绿色)、 43(黄色)、44...
阅读全文
摘要:命令形式: split(str='',number=string.count(str))[n] str 分隔符 number 切分几次,[n] 获取第几个值。 1.如果切分的可迭代对象中包含空元素的解决方法:
阅读全文
摘要:英文文档: staticmethod(function) Return a static method for function. A static method does not receive an implicit first argument. The @staticmethod form
阅读全文
摘要:英文文档: classmethod(function) Return a class method for function. A class method receives the class as implicit first argument, just like an instance me
阅读全文
摘要:英文文档: class property(fget=None, fset=None, fdel=None, doc=None) Return a property attribute. fget is a function for getting an attribute value. fset i
阅读全文
摘要:英文文档: 第一个参数为语句字符串,globals参数和locals参数为可选参数,如果提供,globals参数必需是字典,locals参数为mapping对象。 2.能够读取局部和全部变量,并且能修改全局变量,这个要注意的是,他修改完全局变量的值后,只能在内部使用因为没有 return 的功能,(
阅读全文
摘要:英文文档: This function can also be used to execute arbitrary code objects (such as those created by compile()). In this case pass a code object instead o
阅读全文
摘要:英文文档: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
阅读全文
摘要:英文文档: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) Open file and return a corresponding fil
阅读全文
摘要:英文文档: input([prompt]) If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line f
阅读全文
摘要:英文文档: print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) Print objects to the text stream file, separated by sep and followed by end. se
阅读全文
摘要:英文文档: locals() Update and return a dictionary representing the current local symbol table. Free variables are returned by locals()when it is called in
阅读全文
摘要:英文文档: callable(object) Return True if the object argument appears callable, False if not. If this returns true, it is still possible that a call fails
阅读全文
摘要:英文文档: setattr(object, name, value) This is the counterpart of getattr(). The arguments are an object, a string and an arbitrary value. The string may
阅读全文
摘要:英文文档: getattr(object, name[, default])Return the value of the named attribute of object. name must be a string. If the string is the name of one of th
阅读全文
摘要:英文文档: issubclass(class, classinfo)Return true if class is a subclass (direct, indirect or virtual) of classinfo. A class is considered a subclass of i
阅读全文
摘要:英文文档: isinstance(object, classinfo) Return true if the object argument is an instance of the classinfo argument, or of a (direct, indirect or virtual)
阅读全文
摘要:英文文档: __import__(name, globals=None, locals=None, fromlist=(), level=0) This function is invoked by the import statement. It can be replaced (by impor
阅读全文
摘要:英文文档: 返回当前作用域内的局部变量和其值组成的字典,或者返回对象的属性列表 说明 1. 当函数不接收参数时,其功能和locals函数一样,返回当前作用域内的局部变量。 2. 当函数接收一个参数时,参数可以是模块、类、类实例,或者定义了__dict__属性的对象。
阅读全文
摘要:英文文档: format(value[, format_spec]) Convert a value to a “formatted” representation, as controlled by format_spec. The interpretation of format_spec wi
阅读全文
摘要:英文文档: ascii(object) As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string r
阅读全文
摘要:英文文档: 2. 如果参数为其它类型,则其必须实现__len__方法,并返回整数,否则报错。
阅读全文
摘要:英文文档: class type(object) class type(name, bases, dict) With one argument, return the type of an object. The return value is a type object and generall
阅读全文
摘要:英文文档: hash(object)Return the hash value of the object (if it has one). Hash values are integers. They are used to quickly compare dictionary keys duri
阅读全文
摘要:英文文档: dir([object]) Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attrib
阅读全文
摘要:英文文档: help([object]) Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help s
阅读全文
摘要:英文文档: zip(*iterables) Make an iterator that aggregates elements from each of the iterables. Returns an iterator of tuples, where the i-th tuple contai
阅读全文
摘要:英文文档: sorted(iterable[, key][, reverse]) Return a new sorted list from the items in iterable. Has two optional arguments which must be specified as ke
阅读全文
摘要:英文文档: 反转序列生成新的可迭代对象 说明: 1. 函数功能是反转一个序列对象,将其元素从后向前颠倒构建成一个新的迭代器。 2. 如果参数不是一个序列对象,则其必须定义一个__reversed__方法。
阅读全文
摘要:英文文档: 2. 函数可以接收一个可选的default参数,传入default参数后,如果可迭代对象还有元素没有返回,则依次返回其元素值,如果所有元素已经返回,则返回default指定的默认值而不抛出StopIteration 异常。
阅读全文
摘要:英文文档: 2. 当传入多个可迭代对象时,函数的参数必须提供足够多的参数,保证每个可迭代对象同一索引的值均能正确传入函数。 3. 当传入多个可迭代对象时,且它们元素长度不一致时,生成的迭代器只到最短长度。 4. map函数是一个典型的函数式编程例子。
阅读全文
摘要:英文文档: filter(function, iterable) Construct an iterator from those elements of iterable for which function returns true. iterable may be either a seque
阅读全文
摘要:英文文档: any(iterable) Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to: 判断可迭代对象的元素是否有 True值的元素
阅读全文
摘要:英文文档: all(iterable) Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to: 判断可迭代对象的每个元素都是 True 值 说明: 1. 接受
阅读全文
摘要:英文文档: class objectReturn a new featureless object. object is a base for all classes. It has the methods that are common to all instances of Python cla
阅读全文
摘要:英文文档: super([type[, object-or-type]]) Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for acces
阅读全文
摘要:英文文档: 根据传入的参数生成一个可切片对象 说明: 1. 函数实际上是一个切片类的构造函数,返回一个切片对象。 2. 切片对象由3个属性start、stop、step组成,start和step默认值为None。切片对象主要用于对序列对象进行切片取对应元素。 3. 对应切片对象的3个属性start、
阅读全文
摘要:英文文档: iter(object[, sentinel]) Return an iterator object. The first argument is interpreted very differently depending on the presence of the second a
阅读全文
摘要:英文文档: 根据传入的参数创建一个新的 range 对象 说明: 3. 可以传入一个起始整数和一个结束整数来初始化一个range类型,生成的range类型包含起始整数(包含),和结束整数(不包含)之间的所有整数。 4. 传入了起始整数和结束整数,还可以同时传入一个步进值来初始化一个range类型,生
阅读全文
摘要:英文文档: enumerate(iterable, start=0) Return an enumerate object. iterable must be a sequence, an iterator, or some other object which supports iteration
阅读全文
摘要:英文文档: 2. 不传入参数时,生成的空的不可变集合。
阅读全文
摘要:英文文档: 根据传入的参数生成一个新的集合 说明: 1. 传入一个可迭代对象,生成一个新的集合。 2. 不传入参数时,生成一个新的空集合。 3. 返回的集合是可以修改的。
阅读全文
摘要:英文文档: class dict(**kwarg) class dict(mapping, **kwarg) class dict(iterable, **kwarg) Return a new dictionary initialized from an optional positional a
阅读全文
摘要:英文文档: class list([iterable]) Rather than being a function, list is actually a mutable sequence type, as documented in Lists and Sequence Types — list,
阅读全文
摘要:英文文档: The constructor builds a tuple whose items are the same and in the same order as iterable‘s items. iterable may be either a sequence, a containe
阅读全文
摘要:英文文档: hex(x) Convert an integer number to a lowercase hexadecimal string prefixed with “0x”, for example If x is not a Python int object, it has to de
阅读全文
摘要:英文文档: 将整数转换为8进制的字符串 2. 如果传入参数不是整数,则其必须是一个定义了__index__并返回整数函数的类的实例对象。
阅读全文
摘要:英文文档: bin(x) Convert an integer number to a binary string. The result is a valid Python expression. If x is not a Python int object, it has to define
阅读全文
摘要:英文文档: 2. 它的功能与ord函数刚好相反 3. 传入的参数值范围必须在0-1114111(十六进制为0x10FFFF)之间,否则将报ValueError错误
阅读全文
摘要:英文文档: 返回 unicode 字符对应的整数 2. 其功能和chr函数刚好相反。
阅读全文
摘要:英文文档: class memoryview(obj) 根据输的内容创建一个内存查看对象。 说明: 1. 函数功能返回内存查看对象,实际上是内存查看对象(Momory view)的构造函数。 2. 所谓内存查看对象,是指对支持缓冲区协议的数据进行包装,在不需要复制对象基础上允许Python代码访问。
阅读全文
摘要:英文文档: class bytes([source[, encoding[, errors]]]) Return a new “bytes” object, which is an immutable sequence of integers in the range 0 <= x < 256. b
阅读全文
摘要:英文文档: class bytearray([source[, encoding[, errors]]]) Return a new array of bytes. The bytearray class is a mutable sequence of integers in the range
阅读全文
摘要:英文文档: class str(object='') class str(object=b'', encoding='utf-8', errors='strict') Return a string version of object. If object is not provided, retu
阅读全文
摘要:英文文档: class complex([real[, imag]]) Return a complex number with the value real + imag*1j or convert a string or number to a complex number. If the fi
阅读全文
摘要:英文文档: class float([x]) Return a floating point number constructed from a number or string x. If the argument is a string, it should contain a decimal
阅读全文
摘要:英文文档: class int(x=0) class int(x, base=10) Return an integer object constructed from a number or string x, or return 0 if no arguments are given. If x
阅读全文
摘要:英文文档: class bool([x]) Return a Boolean value, i.e. one of True or False. x is converted using the standard truth testing procedure. If x is false or o
阅读全文
摘要:英文文档: sum(iterable[, start]) Sums start and the items of an iterable from left to right and returns the total. startdefaults to 0. The iterable‘s item
阅读全文
摘要:英文文档: round(number[, ndigits])Return the floating point value number rounded to ndigits digits after the decimal point. If ndigits is omitted, it retu
阅读全文
摘要:英文文档: pow(x, y[, z])Return x to the power y; if z is present, return x to the power y, modulo z (computed more efficiently than pow(x, y)% z). The two
阅读全文
摘要:英文文档: min(iterable, *[, key, default]) min(arg1, arg2, *args[, key]) Return the smallest item in an iterable or the smallest of two or more arguments.
阅读全文
摘要:英文文档: max(iterable, *[, key, default]) max(arg1, arg2, *args[, key]) Return the largest item in an iterable or the largest of two or more arguments. I
阅读全文
摘要:英文文档: divmod(a, b) Take two (non complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using inte
阅读全文
摘要:英文文档: abs(x) Return the absolute value of a number. The argument may be an integer or a floating point number. If the argument is a complex number, it
阅读全文
摘要:1 # !/usr/bin/env python3 2 # _*_coding:utf-8_*_ 3 4 5 def help_sql(cmd): 6 if cmd in func_dic.keys(): 7 print('{} usage:\n '.format(cmd)) 8 if cmd == 'select': ...
阅读全文
摘要:1 # 1.三级菜单 2 menu = { 3 '北京':{ 4 '海淀':{ 5 '五道口':{ 6 'soho':{}, 7 '网易':{}, 8 'google':{} 9 }, 10 ...
阅读全文
摘要:1 #作业:登陆接口 2 user=['test','test1','test2','test3'] 3 password=['test','1test','2test','3test'] 4 count=0 5 while True: 6 if count > 2: 7 print(''' 8 你操作太频繁,请稍后再试! 9 '''...
阅读全文