Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

pythonдµÄÖ¡·Ö¸îº¯Êý

Ç°Ò»ÕóÔÚдһ¸ö×Ô¶¯²âÊÔ³ÌÐòʱÐèÒª°´ÕÕÌض¨×Ö·û¶ÔÊÕµ½µÄÊý¾Ý½øÐÐÖ¡µÄ·Ö¸î£¬Ô­ÓÐÒªÇóÊÇÓÐÿ֡ǰºó¸÷ÓÐÒ»¸öͬÑùµÄÌØÊâ×Ö·û,µ±Ê±¹À¼ÆÏÂʱ¼ä»¹¹»£¬Ï뽫ÆäÀ©Õ¹ÎªÒ»¸ö½ÏΪͨÓù¦ÄÜ£¬¼´Ã¿Ö¡Êý¾ÝÇ°Óи÷ÓÐÒ»¸öÌØÊâ×Ö·û±íʾ¿ªÊ¼ºÍ½áÊø£¬µ«Ç°ºóÕâÁ½×Ö·û¿ÉÒÔ²»Í¬£¬Ò²¿ÉÒÔÖ»ÓÐÒ»¸ö£¨ÔÚÍ·ÔÚβ·Ö¸îЧ¹û²»Í¬£©£¬Í¬Ê±Ñ§Ï°ÁËÒ»Õópython£¬¸Ð¾õÆä´¦ÀíÕâÀàÎÊÌ⻹±È½ÏºÏÊÊ£¬Íê³ÉÁËÒÔϳõ²½µÄ´úÂ룬´Ë¶Î´úÂëÐÔÄÜÉÏ»¹ÐèÓÅ»¯£º
def frame_read(fd,head,tail,timeout):
    'return -- donot recv data return None,recv data but wrong format return [],else return data in tupe format, \
            frame_len -- each frame cmd len,'
    if fd is None or len <= 0:
        print 'fd is None or len <= 0,'
        return None
    fd_type = check_obj_type(fd)
#    print 'connect obj type is %s' % fd_type
    if fd_type == 'invalid_type':
        return None
    cur_time = time.time()
    data = ''
    lines = []
    received = False
    head_found = False
    head_len = len(head)
    tail_len = len(tail)
    temp = None
    frame_len = 512
    hex_str = ''
    while 1:
        if is_timeout(cur_time,timeout):
            print 'wait data timeout.'
            if not received:
                return None
            else:               
      


Ïà¹ØÎĵµ£º

Python²éÕÒÌæ»»

>>> import string
>>> s='adbecf'
>>>
tt=string.maketrans("abc","ABC")
>>> s.translate(tt,"")
'AdBeCf'
>>>
s.translate(tt,"")
ºóÃæµÄÄǸö¿Õ×Ö·û´´¾ÍÊÇÄãҪɾ³ýµÄ×Ö·û£¬±ÈÈçҪɾ³ý»»ÐоÍÊÇs.translate(tt,"\n&q ......

pythonϵÄweb¿ª·¢¿ò¼Ü Django,urlÅäÖÃ

urlÅäÖÃ
ÎÒÃÇÔÚpollsÕâ¸öappÏ´´½¨Ò»¸ö
helloworld.py
from django.http import HttpResponse
def index(request):
    return HttpResponse("Hello, Django.")
ÐÞ¸Ä urls.py
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib ......

PythonÈÕÆÚºÍ×Ö·û´®µÄ»¥×ª

ÓõķֱðÊÇtimeºÍdatetimeº¯Êý
'''
Created on 2009-9-2
@author: jiangqh
'''
import time,datetime
# date to str
print time.strftime("%Y-%m-%d %X", time.localtime())
#str to date
t = time.strptime("2009 - 08 - 08", "%Y - %m - %d")
y,m,d = t[0:3]
print datetime.datetime(y,m,d)

Êä³öµ±Ç°Ê±¼ä ......

ʹÓÃeclipse¿ª·¢Python¡£

Help£­¡·Software Upates£­¡·Find and Install£­¡·Search for new features to install-¡·New remote site£­¡·Ëæ±ãÆð¸önameÈçpydev£¬urlÌî http://pydev.sf.net/updates/ £­¡·È»ºóÕÕ×ÅÌáʾÏÂÔØ°²×°¼´¿É¡£
PydevµÄÅäÖÃ
ÔÚEclipse IDE Ï£¬ ´ò¿ª Window->Preferences... ¶Ô»°¿ò£¬´ÓÓÒ²àµÄÊ÷ÐÎÁбíÖÐÑ¡Ôñ“ PyDev&r ......

Ò»¸ö¼õÉÙ¶à½ø³ÌÏÂpythonÄÚ´æÕ¼ÓõÄС¼¼ÇÉ

¡¡¡¡ÔÚpythonÖÐÈç¹ûҪʹÓÃfork»òÕßmultiprocessÀ´×ö¶à½ø³Ì£¬¼ÙÈçimportµÄ¿âºÜ¶à»òÕߺܴó£¬ÀýÈçwxpython£¬²é¿´¸÷½ø³ÌµÄÄÚ´æÕ¼ÓÃÄã»á·¢ÏÖÁ½¸ö½ø³ÌµÄÄÚ´æÕ¼Óûù±¾ÉÏÏàͬ£¬»»¾ä»°Ëµ£¬Èç¹ûµÚ¶þ¸ö½ø³Ì¸ù±¾²»ÐèÒªÓõ½wxµÄÄÚÈÝ£¬ËüÒ²»á±»¼ÓÔص½ÄÚ´æµ±ÖÐÈ¥¡£¾ÍÄÃwxÀ´×öÀý×Ó£¬Ã»ÓÐimport t wxÕ¼Óôó¸Å8M+Äڴ棬һµ©import wx£¬ÄÚ´æÂíÉ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ