易截截图软件、单文件、免安装、纯绿色、仅160KB

Python Socket编程

1,编写Server.py
import socket
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(('localhost',8081))
while True:
    data,addr=s.recvfrom(1024)
    print 'receive:',data,'from',addr
2,编写Client.py
import socket
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
while True:
    msg=raw_input()
    s.sendto(msg,('localhost',8081))
3,运行程序
不同cmd窗口,分别运行两个py。Client窗口输入信息,Server窗口输出相应信息。


相关文档:

发布python应用程序

【windows+python3.1.2】
发布python应用程序是个很麻烦的事,因为<1>无法编译原生code<2>每个版本的字节码不同<3>如果直接上源码会损害自己的利益——等等
方法1——手动打包
怎么打包呢?一个python文件夹要二十多MB啊!
yes!我们就要清理无用的东西!
先写一个win.py文件: ......

Python之美 Decorator深入详解(一)

There should be one—--and preferably only one –--obvious way to do it.
                                     ......

windows & python & Emacs


设置Emacs的HOME,可以在scratch buffer中输入:(insert (getenv "HOME"))查看
下载python-mode.el
用Emacs打开python-mode.el然后M-x byte-compile-file编译python-mode.el为elc
C-h v查看load-path变量
在HOME/.emacs.d/init.el中添加(setq load-path (cons "D:\\emacs-23.1-bin-i386" load-path))
将py文件与pytho ......

Python 下载网页的几种方法

总结下,Python 下载网页的几种方法
1
 fd = urllib2.urlopen(url_link)
 data = fd.read()
 这是最简洁的一种,当然也是Get的方法
2
通过GET的方法
def GetHtmlSource(url):
    try:
   
        htmSource = ''
 &nb ......

Python 线程池的实现

import urllib2
import time
import socket
from datetime import datetime
from thread_pool import *

def main():
url_list = {"sina":"http://www.sina.com.cn",
"sohu":"http://www.sohu.com",
"yahoo":"http://www.yahoo.com",
"xiaonei":"http://www.x ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号