- 博客(9)
- 收藏
- 关注
转载 python元类
实例对象是由类来创建,那么类又是由什么来创建的呢? 答案就是元类。In [19]: print(type(1)) # 数值的类型 <class 'int'>In [20]: type(1) ...
2020-03-18 14:40:50 66
原创 python的槽
class Teacher(object): __slots__ = ['age','name'] T1 = Teacher()T1.age = 10 #可以创建T1.age #返回10T1.id = 1005 #报错 Teacher has no attribute 'id'只能创建在__slots__中定义的参数...
2020-03-18 09:58:47 1234
原创 python2与3比较重要的区别
1.print由语句变为函数2.弃用<> 改用!=3.from module import * 只能用在模块中,不能用于函数4..from .[module] import name 是相对导入的唯一正确做法,不用点开头的都被当做绝对导入5.__future__模块,将python新版本的功能反向迁移到旧版本如在python2中导...
2020-03-16 14:37:18 76
原创 docker创建镜像报错unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttrib
解决方法:1.加上指定dockerfile文件参数 -f ./dockerfile.txt 2.将dockerFile改为dockerfile
2020-03-12 13:50:38 10220 1
原创 redis找不到配置
开启redis出现Warning:no config file specified解决方法:执行redis-server.exe redis.windows.conf
2020-03-10 15:20:26 857
原创 使用selenium模拟知乎登录,解决验证码与文字障碍
def cacule_xy(num): alpha = 21 #利用selenium的location方法获得图片的坐标,计算相邻文字的中心距离 all_alpha = [] #需要点击的文字的距离列表 first = int(num[0]) #获取第一个点 all_alpha.append(int(num[0...
2020-02-29 15:04:14 438
原创 python利用正则表达式去掉html标签的几种方法
import restr = "<div class='_p2tml'> <span>喝战马</span> <span>就用东鹏</span> <div class='drink_name'> <span style="color:#77858">...
2019-03-31 11:10:46 3020
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人