ÇëÎÊpythonÈçºÎ°Ñ×Ö·û´®ºÍÓÐȨÊ÷»¥»»£¿
ÇëÎÊÎÒÓÐÕâÑùµÄ×Ö·û´® [[A:10, B:8, C:7]D:11, E:12, F:13], ÎÒ»¹ÓиönodeÀ࣬ ABCDEF¶¼ÊÇnodeÀàµÄ¶ÔÏó£¬ÎÒÒª½¨Á¢Ò»¿ÃÊ÷£¬R´ú±í¸ù£¬RÓÐÈý¸ö×Ó½ÚµãDEF£¬ DÓÖÓÐÈý¸ö×Ó½ÚµãABC£¬ ÓÐûÓкõÄÀý×Ó¿ÉÒÔѧϰһϰ¢
Èç¹ûÎÒ½¨Á¢ÁËÕâÑùµÄÒ»¿ÃÊ÷ ÒªÈçºÎ±ãÀûÕâ¿ÅÊ÷ Ò²Çë½ÌÓÐûÓÐÕâ·½ÃæµÄÀý×Ó Ñ§Ï°Ò»Ï лл£¡
treestr = "[[A:10, B:8, C:7]D:11, E:12, F:13]"
MyTree = {}
def createTree(substring,node):
l = len(substring)
if l == 0:
return
if substring[0] == '[':
c = 1
i = 1
while c != 0 and i < l:
if substring[i] == '[':
c += 1
elif substring[i] == ']':
c -= 1
else :
pass
i += 1
j = i
while j < l:
if substring[j] == ',':
break
Ïà¹ØÎÊ´ð£º
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
ËÍÆ¼öÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ãæ£¬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'
ÓÃÕýÔò±í´ïʽȡ³ö ǰºó×ÖĸÏàͬµÄÊý¾Ý ½á¹ûÈçÏÂ:
111 ddd
лл~
Python code:
import re
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,ff ......
ÓÉÓÚÊǵÚÒ»´Î½Ó´¥python,Óï·¨Ò²²»¶®
µ«ÊÇÁÙʱҪÓõ½...
Çë°ïæעÊÍÒ»¶Î´úÂë...²»ÐèҪÿһ¾ä¶¼×¢ÊÍ,ÒòΪÊÇѧjavaµÄ,ËùÒÔ»ù±¾Ë¼Â·»¹ÊÇÓÐÒ»µã
#************************************************ ......
¾ÙÀý£º
Îļþa ´óÔ¼1000ÐРÿÐÐΪһ¸ö´ÊÓï
±ÈÈç˵£º
ÎÄÃ÷
ÎÀÉú
ÓÎÏ·
ÓéÀÖ
¡£¡£¡£¡£
Îļþb ´óÔ¼1000ÐРÿÐÐΪһ¶Î»°
±ÈÈç˵£º
ΪʲôÐèҪʹÓÃ×Ó×鯥ÅäÄØ? Ö÷ÒªÊÇÓÐʱ³ýÁ˽øÐ ......