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 os
(1) os.system
# ½ö½öÔÚÒ»¸ö×ÓÖÕ¶ËÔËÐÐϵͳÃüÁ¶ø²»ÄÜ»ñÈ¡ÃüÁîÖ´ÐкóµÄ·µ»ØÐÅÏ¢
system(command) -> exit_status
Execute the command (a string) in a subshell.
# Èç¹ûÔÙÃüÁîÐÐÏÂÖ´ÐУ¬½á¹ûÖ±½Ó´òÓ¡³öÀ´
>>> os. ......
ÔÎÄ
http://www.hetland.org/python/instant-hacking.php
Instant Hacking[Òë
ÎÄ]
ÒëÕߣº ¿Ï¶¨À´¹ý   ......
Ïà±Èjava¶øÑÔ£¬PythonÓü¸ÐдúÂë¾Í¿ÉÒÔ´úÌæjavaÊ®À´ÐеĴúÂë£¬ÕæµÄ·Ç³£²»´í
'''
Created on 2009-9-2
@author: jiangqh
'''
# file create and write
context = '''hello world
hello china '''
f = file("hello.txt",'w')
f.write(context)
f.close()
Îļþ´´½¨
#use readline() read file
f = o ......
ÔÚ³ÌÐòÖÐʹÓÃÅäÖÃÎļþÀ´Áé»îµÄÅäÖÃһЩ²ÎÊýÊÇÒ»¼þºÜ³£¼ûµÄÊÂÇ飬ÅäÖÃÎļþµÄ½âÎö²¢²»¸´ÔÓ£¬ÔÚpythonÀï¸üÊÇÈç´Ë£¬ÔÚ¹Ù·½·¢²¼µÄ¿âÖоͰüº¬ÓÐ×öÕâ¼þÊÂÇé
µÄ¿â£¬ÄǾÍÊÇConfigParser£¬ÕâÀï¼òµ¥µÄ×öһЩ½éÉÜ¡£
ConfigParser½âÎöµÄÅäÖÃÎļþµÄ¸ñʽ±È½ÏÏóiniµÄÅäÖÃÎļþ¸ñʽ£¬¾ÍÊÇÎļþÖÐÓɶà¸ösection¹¹³É£ ......
#==================================================
import wx
import wx.media
class MyFrame(wx.Frame):
def __init__(self,parent,title):
wx.Frame.__init__(self,parent,-1,title,pos=(150,150),size&;nbsp;=(640, 480),style=wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX| ......