python 断言

摘要: # -*- coding: utf-8 -*- ''' 断言可以判断一个变量是否是指定的数据类型,如果不是指定的数据类型就会报错 ''' aa = "asd" bb = 12 #使用断言 assert type(aa) is str print(aa) assert type(bb) is str print(bb) 阅读全文
posted @ 2017-12-04 10:10 gaizhongfeng 阅读(156) 评论(0) 推荐(0) 编辑

python socket

摘要: 简单的socket: server 端: 客户端: 阅读全文
posted @ 2017-12-04 10:04 gaizhongfeng 阅读(139) 评论(0) 推荐(0) 编辑

异常处理

摘要: # -*- coding: utf-8 -*- ''' except Exception 是捕获所有类型的错误 没有出错的时候会执行else 中的逻辑 finally 里边的语句一定会执行 try: code except error: code else: code finally: code 主动抛出异常使用raise 关键... 阅读全文
posted @ 2017-11-29 19:02 gaizhongfeng 阅读(118) 评论(0) 推荐(0) 编辑

java 触发鼠标点击事件 向linux发送指令

摘要: package click; import java.awt.AWTException; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Robot; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.io... 阅读全文
posted @ 2017-11-29 16:15 gaizhongfeng 阅读(1695) 评论(0) 推荐(0) 编辑

反射机制

摘要: 动态导入: 阅读全文
posted @ 2017-11-29 16:14 gaizhongfeng 阅读(128) 评论(0) 推荐(0) 编辑

静态方法,类方法,属性方法

摘要: 1、全局变量:在模块内,在所有函数、类外面。 2、局部变量:在函数内,在类方法内(未加self修饰的) 3、静态变量:在类内,但不在类方法内。【共同类所有,值改变后,之后所有的实例对象也改变】 4、实例变量:在类方法内,用self修饰的变量。 静态方法 类方法: 属性方法: 阅读全文
posted @ 2017-11-29 16:13 gaizhongfeng 阅读(157) 评论(0) 推荐(0) 编辑

python 类

摘要: 多继承: 阅读全文
posted @ 2017-11-21 09:37 gaizhongfeng 阅读(163) 评论(0) 推荐(0) 编辑

python 正则表达式

摘要: # -*- coding: utf-8 -*- import re #match :从字符串开头匹配字符串 , 如果配到了返回一个对象, 匹配不到返回None res = re.match("test.", "testasDwoedHello") print(res) #获取 匹配的字符串 print(res.group()) #从整个文本开始搜索 sr = re.search("... 阅读全文
posted @ 2017-11-13 10:06 gaizhongfeng 阅读(141) 评论(0) 推荐(0) 编辑

python 加密模块

摘要: # -*- coding: utf-8 -*- import hashlib ''' hashlib 是一个加密的模块 ''' # 以16进制的方式生成MD5 加密 m = hashlib.md5() m.update(b"hello") print(m.hexdigest()) m.update(b"it is hello") print(m.hexdigest()) #这个加密的是h... 阅读全文
posted @ 2017-11-10 18:31 gaizhongfeng 阅读(134) 评论(0) 推荐(0) 编辑

python xml 与配置文件处理

摘要: 配置文件处理: 阅读全文
posted @ 2017-11-10 15:40 gaizhongfeng 阅读(1098) 评论(0) 推荐(0) 编辑