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µ±º¯ÊýÓÃÒª
Ïà¹ØÎÊ´ð£º
pythonºÍpyqtÒÔ¼°Eric4¶¼ÒѾÅäÖúÃÁË£¬´ò¿ªEric4д¸öpython³ÌÐò±ÈÈç¼òµ¥µÄ
print¡°hello£¬world¡±£¬Ôõô±àÒëÔËÐÐÁË£¬Start²Ëµ¥µÄËùÓÐÃüÁî¶¼³öÏÖºÍͼÖв¶àµÄ¶Ô»°¿ò£¬Ó¦µ±ÔõôÔËÐÐÁË£¿
Çó´ó¼ÒÖ¸½Ì
ûÓÐÈËÓà ......
ËÍÆ¼öÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ãæ£¬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
Òì³£´úÂëÈçÏ£º
write a file error: [Errno 2] No such file or directory: 'C:\x0cile.txt'
Traceback (most recent call last):
File "C:\Documents and Settings\USER\×ÀÃæ\¸´ ......