object has no attribute 'ecrire'

fulgar36 at gmail.com fulgar36 at gmail.com
Tue Dec 23 19:42:01 EST 2014


Hello,
I wrote this code (it was on a book)

class TableauNoir:
	def __init__(self):
		self.surface=""
	def ecrire(self, message_a_ecrire):
		if self.surface != "": 
			self.surface += "\n"
		self.surface+=message_a_ecrire
it does not run on the shell and tells (object TableauNoir has no attribute 'ecrire'
could you tell me why it does not work. in the book ecrire should be a method from the class not an attribute
thanks



More information about the Python-list mailing list