Hello this is the "part 2" of my question, what I want to do is that the user when you enter "1" that scrip is executed, first I will pass the code where is the if
eligio = raw_input("""
1)Extraccion de html
2)otro
3)otro
Elige :><: """)
if eligio =="1": #Aqui es donde empezaria el otro codigo
After that if I want the following code to extract the html from a page
# -*- coding: utf-8 -*-
import time, urllib2
import os
import sys
def html(link): # Definimos
try:
res = urllib2.Request(link)
return urllib2.urlopen(res).read()
except Exception, e:
print """Error """
time.sleep(3)
os.system("rm" + " " +name_of_files)
os.system("clear")
return ''
os.system("clear")
http = "http://"
link = http+raw_input(""" Ingresa la url sin http : """)
os.system("clear")
name_of_files = raw_input(""" Ingresa el nombre del archivo mas su extension : """)
archivo = open(name_of_files, "a+")
archivo.write(html(link))
As in the previous question they told me to call the def function, I did it but I set this error
File "Web_T.py", line 20, in html html (1) RuntimeError: maximum recursion ** depth exceeded **
They also explained that error to me, thank you.