ÇëÎÊ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
Ïà¹ØÎÊ´ð£º
ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......
>>> x=-1
>>> if x>0:
print ('11')
>>> else:
SyntaxError: invalid syntax (<pyshell#20>, line 1)
ÍøÉÏËѵÄÒ²ÊÇ£º
>>> x=int(input("Please ent ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
ѧϰpythonµÄ7±¾Êé
°üÀ¨6±¾chm£¬Ò»±¾pdf×ÊÁÏ
¶ÔѧϰpythonÓкܴóµÄ°ïÖú
http://download.csdn.net/source/619791
¾«ÐÄËѼ¯£¬²»Òª»ý·Ö£¬ÄóöÀ´·ÖÏí
лл¥Ö÷£¬ÐÁ¿àÁË~
lz ×îºÃ°ÑÊéÃûºÍ¼òµ¥½éÉܼÓÉ ......