易截截图软件、单文件、免安装、纯绿色、仅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当函数用要


相关问答:

eric4怎么运行python程序?

python和pyqt以及Eric4都已经配置好了,打开Eric4写个python程序比如简单的
print“hello,world”,怎么编译运行了,Start菜单的所有命令都出现和图中差不多的对话框,应当怎么运行了?

求大家指教

没有人用 ......

[提问]Python 如何忽略 whitespace 读入

像 C 的 scanf() 那样
比如读入 1 2 3 a b c
每次读入一个
下面这个应该是你想要的吧:
Python code:

>>> k = raw_input()
0 0123 ds dsl sd
>>> k
'0 0123 ds dsl sd'
>>> ......

关于python class: callerRef的问题

Python code:

class A:
def __init__(self):
self.B_Handle = B_Handle
self.VA = "A_init"
print "Class A init"
def __getattr__(self, name):
......

C# RSA Python - .NET技术 / C#

C#里面用using System.Security.Cryptography; RSACryptoServiceProvider加密过的消息
用Python Crypto中RSA的方法 能直接 解吗?
RSA加密方式不是统一的吗?需要注意些什么?

有帮助。但是没解决问题。。。
......

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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号