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ÈçºÎ¸ßЧÍê³É£¿ÏÈлл¸÷λÁË¡£
½¨Ò飺±ðÖ±½Ó¸úÊý¾Ý¿â±È½Ï¡£Ì«ºÄ·ÑIO¡£
°ÑÄãÐèÒª±È½ÏµÄ×ֶδÓÊý¾Ý ......
ʹÓÃÔ´Îļþ
#!/usr/bin/python
# Filename : helloworld.py
print 'Hello World'
ÎÒÔõôҲ¿´²»¶®£¡Ö»ÊÇ×îºóÒ»ÐÐÎÒÖªµÀ~~Ç°ÃæÁ½ÐÐÊÇʲôÒâË¼ÄØ£¿
½Ì³ÌÉÏ˵Èç¹ûÄãʹÓÃIDLE£¬ÇëʹÓò˵ ......
//ÏÂÃæµÄ´úÂëÔËÐÐÕý³£
tomstrs=re.findall(......)
mtxx=''
for tomstr in tomstrs:
tomstr=tomstr.strip()
if tomstr:
mtxx += tomstr ......
±ÈÈç
Python code:
@orm.validates('title')
def validate_title(self, key, title):
"""Assure that page titles are wikiwords and valid length"""
......
֮ǰÎҵĵçÄÔÉϰ²×°ÁËIronPython2.0,ºó°²×°ShareDevelop3.0,²ÉÓÃĬÈÏÉèÖÃ
ÎÒÔÚShareDevelopÖн¨Á¢ÁËÒ»¸öĬÈϵÄPythonµÄ¿ØÖÆÌ¨»ò´°ÌåÏîÄ¿,ÔËÐÐʱ±¨´íÈçÏÂ:
µ÷ÊÔÆ÷Å׳öÒì³£System.IO.FileNotFoundException: ......