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

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

¡¡¡¡ÔÚpythonÖÐÈç¹ûҪʹÓÃfork»òÕßmultiprocessÀ´×ö¶à½ø³Ì£¬¼ÙÈçimportµÄ¿âºÜ¶à»òÕߺܴó£¬ÀýÈçwxpython£¬²é¿´¸÷½ø³ÌµÄÄÚ´æÕ¼ÓÃÄã»á·¢ÏÖÁ½¸ö½ø³ÌµÄÄÚ´æÕ¼Óûù±¾ÉÏÏàͬ£¬»»¾ä»°Ëµ£¬Èç¹ûµÚ¶þ¸ö½ø³Ì¸ù±¾²»ÐèÒªÓõ½wxµÄÄÚÈÝ£¬ËüÒ²»á±»¼ÓÔص½ÄÚ´æµ±ÖÐÈ¥¡£¾ÍÄÃwxÀ´×öÀý×Ó£¬Ã»ÓÐimport t wxÕ¼Óôó¸Å8M+Äڴ棬һµ©import wx£¬ÄÚ´æÂíÉÏì®Éýµ½27M+£¬Èç´ËÒ»À´£¬Á½¸ö½ø³Ì¾ÍÒªÕ¼50m+¡£ÒÔÉÏÊý¾ÝÕâÖ»ÊǶÔÒ»¸öºÜСµÄpython³ÌÐò¶øÑÔ£¬ÒªÊÇÒ»¸öÐèÒªµ¼ÈëºÜ¶à¿âÎļþµÄ³ÌÐò£¬ÄÇÇé¿ö¿É¾Í²»Ò»ÑùÁË¡£
¡¡¡¡¾­¹ý¼¸·¬³¢ÊÔ£¬±ÊÕßÕÒµ½ÓÃ__import__£¬ÔÚÔËÐÐʱÔÙÈë¿âµÄ·½·¨¡£ÆäʵÊǷdz£¼òµ¥µÄ£¬ÀýÈçÒÔÏÂÀý×Ó£º
from multiprocessing.managers import BaseManager
from multiprocessing import freeze_support
import os
class MyManager(BaseManager):
pass

global manager
if __name__ == '__main__':
freeze_support()
manager = MyManager()
switch = __import__("myclass",globals(),locals())
manager.register("C", myclass.C)
manager.start()
gui = __import__("mygui", globals(),locals())
mygui.manager = manager
app = mygui.MyApp(0)
app.MainLoop()
manager.shutdown()
os._exit(0)
ÕâÑù¾Í¿ÉÒÔ±ÜÃâÁ½¸ö½ø³Ì¼ÓÔز»±ØÒªµÄ¿â¶øÔç³ÉÄÚ´æµÄÀË·Ñ¡£


Ïà¹ØÎĵµ£º

Python²éÕÒÌæ»»

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

[Python and or ]Python ÖÐ and or Ö® ÎÒµÄÀí½â

c´úÂë:
int x = a>b?6,6;
ÕâÖÖÓï¾äPythonÖÐÒ²ÓУº
¿ÉÒÔͨ¹ýand or×éºÏÀ´ÊµÏÖ¡£¸öÈËÈÏΪÕâÖÖÓï¾ä¾¡Á¿ÉÙµãºÃ¡£
python°ÑÕâÀàÐ͵ŦÄÜ·¢Ñï¹âÁË´ó¡£µ«ÊÇÓÉÓÚÕâÖÖ×éºÏ±È½ÏÈÆ£¬ËùÒÔÓÐʱºò±È½Ï¾À½á:
±ÈÈç:
5 or 6 and 6  ·µ»Øwhat?
0 or 5  ·µ»Øwhat?
8 and 7  ·µ»Øwhat?
ÓÚÊÇÕûÀíÁËÏ£º
1.pyhon ÖÐÓ ......

beginning python summary chapter 4 ×Öµä

1¡¢PythonÖ®ÖÐΨһÄÚ½¨µÄÓ³ÉäÀàÐ;ÍÊÇ×ֵ䣨Dictionary£©¡£×ÖµäÖеÄÖµ²¢Ã»ÓÐÌØÊâµÄ˳Ðò£¬µ«ÊǶ¼°´Õչؼü×Ö£¨Key£©½øÐд洢£¬¹Ø¼ü×Ö¿ÉÒÔÊÇÊý×Ö¡¢×Ö·û´®£¬ÉõÖÁÊÇÔª×飨Tuple£©¡£
2¡¢×ÖµäµÄÓï·¨£º×ÖµäÃû = {'¼ükeys':'Öµvaules','¼ükeys':'Öµvaules','¼ükeys':'Öµvaules',...}£¬×ÖµäÖаüº¬ºÜ¶à¶Ô£¨³ÆΪÌõÄ¿items£©£¬ÓÉ£¨keys£ ......

pythonµÄÁé»î

ÏîÄ¿ÐèÒª£¬¸Õ¸Õ½Ó´¥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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ