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

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;


Ïà¹ØÎÊ´ð£º

¹ØÓÚÓÃPython´¦Àí´óÁ¿Êý¾ÝµÄÎÊÌâ

ÎÒÏÖÔÚÒª´¦ÀíÊý°ÙÍòÌõÊý¾Ý£¬´¦Àí¹ý³ÌÊÇͨ¹ý±È½ÏÊý¾ÝÀïÊÇ·ñÓÐÖ¸¶¨µÄ×Ö·û´®£¬ÔÙ²åÈëµ½ÁíÍâµÄ±íÖУ¬ÇëÎÊÓÃPythonÈçºÎ¸ßЧÍê³É£¿ÏÈлл¸÷λÁË¡£

½¨Ò飺±ðÖ±½Ó¸úÊý¾Ý¿â±È½Ï¡£Ì«ºÄ·ÑIO¡£
°ÑÄãÐèÒª±È½ÏµÄ×ֶδÓÊý¾Ý ......

python½Ì³ÌÖÐʹÓÃÔ´ÎļþµÄÎÊÌâ~~

ʹÓÃÔ´Îļþ

#!/usr/bin/python
# Filename : helloworld.py
print 'Hello World'

ÎÒÔõôҲ¿´²»¶®£¡Ö»ÊÇ×îºóÒ»ÐÐÎÒÖªµÀ~~Ç°ÃæÁ½ÐÐÊÇʲôÒâË¼ÄØ£¿
½Ì³ÌÉÏ˵Èç¹ûÄãʹÓÃIDLE£¬ÇëʹÓò˵ ......

µÚÒ»´ÎÓÃPythonд³ÌÐò£¬Ê¹ÓÃfindº¯ÊýÓöµ½Ò»¸öÎÊÌâ

//ÏÂÃæµÄ´úÂëÔËÐÐÕý³£

tomstrs=re.findall(......)
mtxx=''
for tomstr in tomstrs:
  tomstr=tomstr.strip()
  if  tomstr:
      mtxx += tomstr ......

ÇëÎÊpythonÀïÃæµÄ@ʲôÒâ˼£¿

±ÈÈç

Python code:
@orm.validates('title')
def validate_title(self, key, title):
"""Assure that page titles are wikiwords and valid length"""
......

ShareDevelop3.0½¨Á¢PythonÏîÄ¿ÔËÐÐʱ±¨´í

֮ǰÎҵĵçÄÔÉϰ²×°ÁËIronPython2.0,ºó°²×°ShareDevelop3.0,²ÉÓÃĬÈÏÉèÖÃ
ÎÒÔÚShareDevelopÖн¨Á¢ÁËÒ»¸öĬÈϵÄPythonµÄ¿ØÖÆÌ¨»ò´°ÌåÏîÄ¿,ÔËÐÐʱ±¨´íÈçÏÂ:

µ÷ÊÔÆ÷Å׳öÒì³£System.IO.FileNotFoundException: ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ