08 2018 档案
摘要:#动态 class Shape: def draw(self): print('shape的draw()被调用') class Point(Shape): def draw(self): print('正在画一个点') class Circle(Point): def draw(self): pri
阅读全文
posted @ 2018-08-27 14:54
Sky__liu
摘要:/usr/bin/python3.5 /home/tarena/PycharmProjects/untitled/day9_25/text.py['Boy', 'ama', 'is', 'this'] Process finished with exit code 0 绝对匹配:正则表达式要完全匹配
阅读全文
posted @ 2018-08-25 17:18
Sky__liu
摘要:#coding=utf-8 import os,time while True: cmd='ps -e|grep %s'%('python3') a=os.popen(cmd)#返回一个对象 txt=a.readlines() if len(txt)==0: print('没有') break else: ...
阅读全文
posted @ 2018-08-21 18:36
Sky__liu
摘要:字节串的构造函数: bytes() #生成一个字的字节串,等同于b'' bytes(整数可迭代对象) 用可换代对象创建一个字节串 bytes(整数n) 生成n个值为0的字节串 bytes(字符串,encoding='utf8') 用字符串的转换编码生成一个字节串bytes的运算: 与其它序列的去处规则完全相同: + +...
阅读全文
posted @ 2018-08-21 16:54
Sky__liu
摘要:https://www.cnblogs.com/JayeHe/p/7442311.html python 协程, 异步IO Select 和 selectors 模块
阅读全文
posted @ 2018-08-21 16:23
Sky__liu
摘要:import os,shutil def mycopyfile(srcfile,dstfile): if not os.path.isfile(srcfile): print ("%s not exist!"%(srcfile)) else: fpath=os.path.dirname(srcfile) #获取文件路径 if ...
阅读全文
posted @ 2018-08-21 16:21
Sky__liu
摘要:作用是生成一个个性化的可迭代对象 函数 zip (iter1 [,iter2[...]]) 返回一个zip对象,此对象用于生成元组,此元组的每个数据来源于参数 中的可对象,当最小的可迭代对象不再提供数据时迭代结束 enumetate(iterable [ , start]) 生成带索引的枚举对象,返
阅读全文
posted @ 2018-08-21 15:51
Sky__liu
摘要:通过以上例子,可知道 ==>>生成器表达式是现用现生成,列表推导式是一次性生成静态数据
阅读全文
摘要:import threading import time class timer(threading.Thread): # The timer class is derived from the class threading.Thread def __init__(self, num, inter
阅读全文
posted @ 2018-08-20 14:34
Sky__liu
摘要:错误类型说明 <!-- 以下内容必讲 --> ZeroDivisionError 除(或取模)零 (所有数据类型) ValueError 传入无效的参数 AssertionError 断言语句失败 StopIteration 迭代器没有更多的值 IndexError 序列中没有此索引(index)
阅读全文
posted @ 2018-08-20 11:58
Sky__liu
摘要:要理解select.select模块其实主要就是要理解它的参数, 以及其三个返回值。select()方法接收并监控3个通信列表, 第一个是所有的输入的data,就是指外部发过来的数据,第2个是监控和接收所有要发出去的data(outgoing data),第3个监控错误信息在网上一直在找这个sele
阅读全文
posted @ 2018-08-16 14:29
Sky__liu
摘要:https://github.com/mattkang0/sandglass sandglass(沙漏)——一个让人解脱的python时间处理库
阅读全文
posted @ 2018-08-10 17:00
Sky__liu
摘要:#__new__()方法的特性: __new__()方法是在类准备将自身实例化时调用。 __new__()方法始终都是类的静态方法,即使没有被加上静态方法装饰器。是因为无论怎样重写类的__new__()函数,追溯到源头都是继承自object的__new__()函数, 而object类中定义的__ne
阅读全文
posted @ 2018-08-08 17:50
Sky__liu
摘要:1 # #公鸡5文钱一只,母鸡3文钱一只,小鸡3只一文钱,用100文钱买一百只鸡,其中公鸡,母鸡,小鸡都必须要有,问公鸡,母鸡,小鸡要买多少只刚好凑足100文钱。 2 # a=3*100+1 3 # a_g=5 4 # a_m=3 5 # a_x=1/3 6 # for i in range(1,a): ##第一重循环,...
阅读全文
posted @ 2018-08-07 17:34
Sky__liu
摘要:a=[1,3,5]b=ac=aa.pop(1)print(a,b,c) 当列表绑定到变量上的时候,在删除原列表元素的时候,列表所绑定的其它变量,也会跟着 一起变动 输出==》[1, 5] [1, 5] [1, 5]
阅读全文
posted @ 2018-08-07 11:04
Sky__liu
摘要:需要用python的脚本来快速检测一个文件内的二个时间日期字符串的大小,其实实现很简单,首先一些基础的日期格式化知识如下 ''' %a星期的简写。如 星期三为Web %A星期的全写。如 星期三为Wednesday %b月份的简写。如4月份为Apr %B月份的全写。如4月份为April %c: 日期时
阅读全文
posted @ 2018-08-06 23:14
Sky__liu
摘要:会用红色标注出 2 3 4 django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_
阅读全文
posted @ 2018-08-04 23:26
Sky__liu

浙公网安备 33010602011771号