PythonÖеÄUnicodeÔÚDelphiÈçºÎ»¹Ô³ÉGb2312£¿
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
function UniCode2GB(S : String):String;
Var
I: Integer;
begin
I := Length(S);
while I >=4 do
begin
try
Result :=WideChar(StrToInt('$'+S[I-3]+S[I-2]+S[I-1]+S[I]))+ Result;
except end;
I := I - 4;
end;
end;
Ïà¹ØÎÊ´ð£º
ÈçÌâ¡£
¸Ð¾õÈçºÎ£¿½»Á÷Ï¡£
ûÓÐÑо¿¹ý£¬ºÇºÇ
ÓÐɶÑо¿Í·£¿
ÄǸö¶«Î÷£¬ÊǸö¼¦Àߣ¬£¬Ã»ÓÐʲôÒâ˼£¬·¢ÏÖ£¡£¡
ÓÃÀ´×öB/S¼Ü¹¹µÄMISϵͳµÄ»°Ó¦¸Ã¿ÉÒÔÌá¸ß½çÃ濪·¢µÄЧÂÊ°É£¿
ÒòΪ²»ÊìϤDelphi £ ......
ÎÒÏÖÔÚÊÇÕâÑùµÄ
¿ªÁËÒ»¸ö×ÓỊ̈߳¬¶ÁÈ¡ÏÂÃæµÄÏûÏ¢
±¾ÒâÊÇ
Python code:
while not self._stopevent.isSet( ):
re=¶ÁȡϲãÏûÏ¢
if re>0:
´¦Àí
else:
pass
¼ÙÈ ......
ÕÕ×ÅÊéÉÏдµÄ£¬Ö´ÐÐʱ±¨´í£¨Python2.6£©
import wx
class InsertFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'F ......
Èç¹ûÒ»¶Î´úÂë
Python code:
#!/usr/bin/python2.5
from urllib2 import Request,urlopen,URLError
def check():
req = Request('http://www.google.com')
try:
res = urlopen(req).read()
......
ÈçÌ⣬
¡¶pythonÔ´ÂëÆÊÎö¡·ÖеÚ32Ò³£¬
Óиö¼ì²é¼Ó·¨½á¹ûÊÇ·ñÒç³öµÄ´úÂ룬
´óÖÂÈçÏ£º
C/C++ code:
long a, b, x;
x = a + b;
//¼ì²é½á¹ûÊÇ·ñÒç³ö
if((x^a)>=0 || (x^b)>=0)
return OK; // ......