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:
 
Ïà¹ØÎĵµ£º
ÔÎÄ
http://www.hetland.org/python/instant-hacking.php
Instant Hacking[Òë
ÎÄ]
ÒëÕߣº ¿Ï¶¨À´¹ý   ......
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 ......
1¡¢PythonÖ®ÖÐΨһÄÚ½¨µÄÓ³ÉäÀàÐ;ÍÊÇ×ֵ䣨Dictionary£©¡£×ÖµäÖеÄÖµ²¢Ã»ÓÐÌØÊâµÄ˳Ðò£¬µ«ÊǶ¼°´Õչؼü×Ö£¨Key£©½øÐд洢£¬¹Ø¼ü×Ö¿ÉÒÔÊÇÊý×Ö¡¢×Ö·û´®£¬ÉõÖÁÊÇÔª×飨Tuple£©¡£
2¡¢×ÖµäµÄÓï·¨£º×ÖµäÃû = {'¼ükeys':'Öµvaules','¼ükeys':'Öµvaules','¼ükeys':'Öµvaules',...}£¬×ÖµäÖаüº¬ºÜ¶à¶Ô£¨³ÆÎªÌõÄ¿items£©£¬ÓÉ£¨keys£ ......
Éè¼ÆÒ»¸öIPÀࣺ
Éè¼Æ1 ÒªÇ󣺳õʼ»¯Ê±¸ø¶¨ipµØÖ·²¢ÅжÏipµØÖ·µÄºÏ·¨ÐÔ
Àà·½·¨£ºÅжÏipµØÖ·ºÏ·¨ÐÔ
ʵÀý·½·¨£º½«ipµØÖ·×ª»¯Îª10½øÖƵıíʾÐÎʽ¼°16½øÖƵıíʾÐÎʽ
......
ÏîÄ¿ÐèÒª£¬¸Õ¸Õ½Ó´¥python¡£
½ñÌì¿´Êé¿´µ½a>b==c £¬a,b,cΪinteger
ÔÚC/C++/C#ÖУ¬a>bΪboolean,²»¿ÉÓëinteger±È½ÏÏàµÈ
µ«python a>b==cµÈЧÓÚ((a>b)&&(b==c))
ÔÚpythonÖеÄд·¨ÊÇa>b and b==c ......