易截截图软件、单文件、免安装、纯绿色、仅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通讯簿

这两天在学习python语言,也学着写了个通讯簿,练习入门下!
功能包括以下:
1、增加一条记录
2、删除一条记录
3、修改一条记录
4、查询一条记录
5、显示整个通讯簿
6、帮助提示
7、版本显示
8、退出等
首先建立一个Person类,即Person.py文件,用来保存联系人记录:
class Person:
def __init__(self, nam ......

python查找中文字符

#filename Seek.py
import unicodedata
import sys
import os
class Seek():
    """
    功能:查找中文,并替换成指定字符或字符串
    使用方法:python脚本用法
    参数说明:
        -d& ......

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 ......

Python 中的字符编码

1、str类型可以理解为一个二进制block,或multibyte
2、multibyte_str.decode("<multibyte_encode_method>")  -> unicode
3、unicode_str.encode("<multibyte_encode_method>")  -> multibyte_str(binary block)
4、unicode_str 的操作参数也应为unicode,如:unicode_str.find("样本".deco ......

python的编码问题

  前两天理解了unicode、utf-8、gb2312这些编码之间的关系以后,今天终于弄明白了在python里面的编码问题。我们在写python脚本时如果有中文的字符串,在运行的时候有可能会报错也有可能会出现乱码。一般加上# -*- coding:utf-8 -*-就不会报错了,但是还可能有乱码问题,而且同样的代码在不同的编辑器中得出的结果 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号