Arafath10 commited on
Commit
e20cfda
1 Parent(s): 5553cc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -5,6 +5,28 @@ from bs4 import BeautifulSoup
5
  import pyjokes
6
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
 
10
  def joke():
@@ -55,7 +77,7 @@ def google(name):
55
  text =""
56
  if "how to learn" in name or "steps for learning" in name or "step for learning" in name or "steps for" in name or "step for" in name:
57
  try:
58
- text = aitext(name)+"\n\n"
59
  except:
60
  text =""
61
 
 
5
  import pyjokes
6
 
7
 
8
+ def code(name):
9
+ name = name.split('learn')[-1]
10
+ name = name.split('start')[-1]
11
+ name = name.split()[0]
12
+ s={}
13
+ result = {"",""}
14
+ text = ""
15
+ url = "https://www.w3schools.com/"+name+"/"+name+"_syntax.asp"
16
+ r = requests.get(url)
17
+ soup = BeautifulSoup(r.text,"html.parser")
18
+
19
+
20
+ heading_object=soup.find_all('div')
21
+ n=1
22
+ for info in heading_object:
23
+ info1 = str(info)
24
+ if '</script>' not in info1 and '<div class="w3-col l10 m12" id="main">' in info1:
25
+
26
+ #print(n)
27
+ return str(info.text).split('Next ❯')[1]
28
+ n=n+1
29
+
30
 
31
 
32
  def joke():
 
77
  text =""
78
  if "how to learn" in name or "steps for learning" in name or "step for learning" in name or "steps for" in name or "step for" in name:
79
  try:
80
+ text = code(name)+"\n\n"
81
  except:
82
  text =""
83