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

PYTHON Ò»¸ö³ÌÐò£¬23ÐÐÓÐ´í£¬²»Ã÷°×Ϊʲô ¾´ÇëÖ¸½Ì£¡

Python code:


class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def paint(self, factory):
point = factory.getPoint()
corner = factory.getCorner()
corner.leftUp()
point.line(self.width - 2)
corner.rightUp()
print()
for i in range(self.height - 2):
point.line(self.width)
print()
corner.leftDown()
point.line(self.width - 2);
corner.rightDown();
print()

class Dot:
def line(self, width):
for i in range(width):
print("-",end="")
class Sharp:
def leftUp(self):
print("#", end="")
def rightUp(self):
print("#", end="")
def leftDown(self):
print("#", end="")
def rightDown(self):
print("#", end="")

class DotSharpFactory:
def getPoint(self):
return Dot()
def getCorner(self):
return Sharp()

rect = Rectangle(20, 10)
rect.paint(DotSharpFactory())


23ÐÐÓÐ´í£¬²»Ã÷°×Ϊʲô ¾´ÇëÖ¸½Ì£¡

Ò²¾ÍÊÇ ÕâÒ»¾ä print("-",end="") Ö¸ÔÚ ¡°£½¡± ÕâÀïÓÐÎÊÌâ

¾õµÃpython 3ÏÂÓ¦¸Ã²»»á´í¡£ÎÒÊÇÓÃ2.6µÄ£¬printµ±º¯ÊýÓÃÒª


Ïà¹ØÎÊ´ð£º

IIS 7 python 2.6 cgi ÎļþÉÏ´«ÎÊÌâ

ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......

³ÏÕÐPython³ÌÐòÔ±²ÎÓë¼ÆËã»úÊé¼®³ö°æ

ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£ 
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º 
1¡¢·áºñµÄ¸å³ê¡£ 
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£ 
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......

pythonÈçºÎ»ñµÃÍøÒ³JavaScript½Å±¾Ö´ÐкóµÄÈ«²¿Ô´´úÂë

RT¡£

ÎÒÏëÒªÏÂÔØÒ»¸öÍøÕ¾ÉϵÄͼƬ£¬µ«ÊǸÃÍøÕ¾µÄͼƬµØÖ·ÊÇͨ¹ýä¯ÀÀÆ÷Ö´ÐÐÍøÒ³µÄJavaScript½Å±¾ºó²Å·µ»ØµÄ£¬Ê¹ÓÃurllib2µÄurlopenÖ»Äܵõ½´øÓÐJavaScript´úÂëµÄÍøÒ³Ô´´úÂë¡£

ÏëÒªÓÃwxÄ£¿éµÄwx.lib.iew ......

Python¶þάÊý×鸳ֵÎÊÌâ

RowNum=18
ColumnNum=10
SquareList=[[0 for a in range(ColumnNum)] for b in range(RowNum)]
ActiveList=[[0 for a in range(ColumnNum)] for b in range(RowNum)]

ActiveList[0][5]=1
SquareL ......

python½âÎöxmlÎļþ

ʹÓÃxml.dom½âÎö¼¸Õ×µÄxmlÎļþ£¬·Ç³£»ºÂý£¬ÓÐÖÖ¼ÙËÀµÄ¸Ð¾õ¡£Ôõô½â¾ö£¿ÓÃÆäËû¿âÊÇ·ñ»áºÃЩ£¬ÔÝʱֻ֪µÀÕâ¸ö¿âµÄ¡£
Äã¿ÉÒÔÊÔÒ»ÏÂElementTree


pythonµÄ¹Ù·½Àý×Ó
import xml.parsers.expat

# 3 handler ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ