
Programa de html con Python 3.3.1
Publicado por Angel (19 intervenciones) el 13/05/2013 20:23:39
Hola amigos:
Soy nuevo en esto de programar, y tengo el siguiente problema:
He hecho el programa html.py, y es el siguiente:
He hecho lo siguiente con el Python shell:
Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 2013, 20:25:12) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import html
>>> pagina1=html.buffer()
>>> pagina2=html.buffer()
>>> pagina1.inicio('Página 1')
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
pagina1.inicio('Página 1')
File ".\html.py", line 11, in inicio
self.add[inicio[titulo]]
NameError: global name 'inicio' is not defined
>>>
Me dice que el nombre global no está definido, y yo creo que si está definido.
He mirado en Google de todas las maneras posibles y no he podido resolver mi problema, así que si me hechan una mano se lo agradecería infinitamente.
Saludos: Angel
Soy nuevo en esto de programar, y tengo el siguiente problema:
He hecho el programa html.py, y es el siguiente:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class buffer:
def __init__(self):
self.text=''
def add(self,texto):
self.text=self.text+texto
def pop(self):
temp=self.text
self.text=''
return temp
def inicio(self,titulo):
self.add(inicio(titulo))
def encabezado(self,nivel,string):
self.add(encabezado(nivel,string))
def horizontal(self):
self.add(horizontal())
def destino(self,clave,texto):
self.add(destino(clave,texto))
def liga(self,url,texto):
self.add(liga(url,texto))
def parrafo(self,texto):
self.add(parrafo(texto))
def saltolinea(self):
self.add(saltolinea())
def tabla(self,arreglo):
self.add(tabla(arreglo))
def final(self):
self.add(final())
He hecho lo siguiente con el Python shell:
Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 2013, 20:25:12) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import html
>>> pagina1=html.buffer()
>>> pagina2=html.buffer()
>>> pagina1.inicio('Página 1')
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
pagina1.inicio('Página 1')
File ".\html.py", line 11, in inicio
self.add[inicio[titulo]]
NameError: global name 'inicio' is not defined
>>>
Me dice que el nombre global no está definido, y yo creo que si está definido.
He mirado en Google de todas las maneras posibles y no he podido resolver mi problema, así que si me hechan una mano se lo agradecería infinitamente.
Saludos: Angel
Valora esta pregunta


0