ÓÃÕ»½âÎöËãÊõ±í´ïʽ[Python°æ]
´úÂëÖвÉÓÃÁËÈý²½ÊµÏÖËãÊõ±í´ïʽµÄ½âÎö:
1. ½«ËãÊõ±í´ïʽ(×Ö·û´®)ת»»³ÉÒ»¸öÁбíparseElement·½·¨
2. ½«Áбí±íʾµÄËãÊõ±í´ïʽת»»³Éºó׺±í´ïʽchangeToSuffix
3. ¼ÆËãºó׺±í´ïʽµÄ½á¹û
ÕâÀïÎÒÊÇΪÁË·½±ã, ¾ÍдÁ˸öparseElement, ²»ÏëÄÇ·½·¨Ð´µ½ºóÃæÈ´°Ñ×Ô¼ºÈÆ×¡ÁË, ¿ÉÒÔÏëÏóÒ»¸ö´ø×ÔÔö, λ, Âß¼, ËãÊõµÄ±í´ïʽµÄÊýÖµÌáÈ¡ÊǶàôµÄ¸´ÔÓ...
parseElement×Ô¼º¸Ð¾õÊÇÒ»¸ö±È½Ïʧ°ÜµÄ·½·¨, ËùÒÔ´ÓÒ»¸öÆÕ±éµÄ½Ç¶ÈÀ´·ÖÎöÒÔÏÂËãÊõ±í´ïʽµÄ½âÎö:
ÒÔ(A + B) * C / D ** E + F * GΪÀý
µÚÒ»²¿·Ö: ½«ÖÐ׺±í´ïʽ(ÉÏÃæ¾ÍÊÇ, ¾ßÌåÈ¥²éÓйØÇ°×º, ÖÐ׺, ºó׺±í´ïʽ)
ÕâÒ»²½ÐèÒªÒ»¸öÕ»ÓÃÀ´±£´æÔËËã·û, Ò»¸ö×Ö·û´®ÓÃÀ´±£´æÊä³öµÄºó׺±í´ïʽ
·ûºÅÕ»: signStack
ºó׺±í´ïʽ: result
¹ý³Ì: ¶ÁÈ¡±í´ïʽÖÐÿ¸öÔªËØ(Êý×Ö»òÔËËã·û, ÎÒµÄparseElementÒâÔÚ½â¾öÕâ¸öÎÊÌâ, È´×öµÄ²»³É¹¦)
ÔÔò:
1. ²Ù×÷ÊýÖ±½ÓÊä³öµ½result
2. (Ö±½Ó½øÕ»
3. )³öÕ»Ö±µ½Óöµ½Ò»¸ö"("(×¢Òâ: ÕâÀï"("±ØÐë³öÕ»), Öмä³öÕ»µÄÔªËØ°´³öջ˳ÐòÊä³öµ½result
4. ÆäËûÔËËã·û, ¼ì²éÕ»¶¥ÔªËØ, Èç¹ûÕ»¶¥±Èµ±Ç°ÔËËã·ûÓÅÏȼ¶¸ß»òÏàͬ(ÓÅÏȼ¶Ïàͬ, °´Ë³ÐòÖ´ÐÐ)ÔòÏȽ«Õ»¶¥³öÕ», ÔÙÈëÕ». Èç¹ûµ±Ç°ÔªËØÓÅÏȼ¶¸ß, ÔòÖ±½ÓÈëÕ».
²Ù×÷¹ý³ÌµÄ״̬±ä»¯
signStack |result | current char
------------------------------------------------------
( | |(
( |A |A
(, + | |+
(  
Ïà¹ØÎĵµ£º
Ô´´úÂëÏÂÔØ£ºÏÂÔØµØÖ·ÔÚÕâÀï
A Byte Of Python
ÖйØÓڼ̳ÐÓÐÕâÑùµÄÎÄ×Ö£º
Suppose you want to write a program which has to keep track of the
teachers and students in a college. They have some common
characteristics such as name, age and address. They also have specific
characteristics such as sala ......
——ÓÉÓÚ×î½üÔÚ×öÓйØÍøÒ³ËÑË÷µÄÏîÄ¿£¬Éæ¼°µ½Ò»Ð©±àÂë·½ÃæµÄ֪ʶ£¬Ð¡µÜÔÚÍøÉÏżȻµØ·¢ÏÖÁËÕâôһƪÎÄÕ£¬ºÜÒ×¶®£¬²»»Þɬ£¬ÎªÁË·½±ã×Ô¼ºÒ²Í¬Ê±ÄÜ·½±ã´ó¼Ò£¬¾ÍתÁ˹ýÀ´£¬ÒÔ×÷²Î¿¼……
ÎÄÕ³ö´¦£ºhttp://blog.csdn.net/tingsking18/arc ......
½ñÌì¿´ÁËÐòÁÐÀàÐÍÏà¹ØµÄ±È½Ï²Ù×÷.
ÔÚpythonºËÐıà³Ì(2nd)Ò»ÊéÖÐ6.13.1Õ½ÚÖÐ, ¸ø³öÁËÁбí±È½ÏµÄÒ»¸ö×¼Ôò..
¸öÈ˸оõ»¹ÊDz»ºÜÍêÉÆ:
Èç¹ûɨÃèµ½Á½¸öÁбíÖе±Ç°±È½ÏÔªËØÊDz»¿É±È½ÏµÄ, ÄÇô·µ»ØÊ²Ã´??
ÎÒÓõÄÊÇpython2.6....
¶ÔÕâ¸öÎÊÌâ×öÁËһЩ²âÊÔ, ×Ô¼ºÄ¿Ç°¸Â¾øµ±±È½ÏÓöµ½ÉÏÊöÇé¿öʱ, ÊÇʹÓÃÁ½¸öÁбíµÄÄÚ´æµØÖ·ÖµÀ´±È½ ......
filename=raw_input('enter file name:')
f=open(filename,'rb')
f.seek(0,0)
index=0
for i in range(0,16):
print "%3s" % hex(i) ,
print
for i in range(0,16):
print "%-3s" % "#" ,
print
while True:
temp=f.read(1)
if len(temp) == 0:
break
else:
print "%3s" % temp.encode('hex'),
......
ZoundryDocument
Python skin is known for its color variations and for its elasticity; it is
the warmest leather of the season and ideal for the manufacture of many luxury
goods. Sometimes natural patterns can be hidden when they're done in black, but
the finish here has a bit of a shine to it ......