Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CSE16231
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Prannesh SathyaMoorthy
CSE16231
Commits
0c47f657
Commit
0c47f657
authored
Mar 6, 2019
by
Prannesh SathyaMoorthy
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
440a7ad1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
p2_21.py
+64
-0
64 additions, 0 deletions
p2_21.py
with
64 additions
and
0 deletions
p2_21.py
0 → 100644
+
64
−
0
View file @
0c47f657
from
bs4
import
BeautifulSoup
import
requests
page_link
=
"
https://www.google.com/search?q=top+10+technology&source=lnms&tbm=nws&sa=X&ved=0ahUKEwjrn8v15uzgAhWJfn0KHQPSBqAQ_AUIDygC&biw=1301&bih=670
"
page_response
=
requests
.
get
(
page_link
,
timeout
=
25
)
#page_content=BeautifulSoup(page_response.content,"html.parser")
Soup
=
BeautifulSoup
(
page_response
.
content
,
"
html.parser
"
)
print
(
"
Google
"
)
for
i
in
range
(
0
,
10
):
a
=
Soup
.
find_all
(
'
h3
'
)[
i
].
get_text
()
print
(
a
)
from
bs4
import
BeautifulSoup
import
requests
page_link
=
"
https://finance.yahoo.com/tech/
"
page_response
=
requests
.
get
(
page_link
,
timeout
=
25
)
#page_content=BeautifulSoup(page_response.content,"html.parser")
Soup
=
BeautifulSoup
(
page_response
.
content
,
"
html.parser
"
)
print
(
"
Yahoo
"
)
for
i
in
range
(
0
,
10
):
a1
=
Soup
.
find_all
(
'
h3
'
)[
i
].
get_text
()
print
(
a1
)
set1
=
set
(
a
.
split
(
'
'
))
set2
=
set
(
a1
.
split
(
'
'
))
print
(
set1
!=
set2
)
print
(
set1
,
"
==
"
,
set2
)
set1
=
set
(
a1
.
split
(
'
'
))
set2
=
set
(
a
.
split
(
'
'
))
print
(
set1
==
'
Samsung
'
)
print
(
set1
,
"
==
"
,
set2
)
#hist ={}
#for i in range(0,10):
# hist[set1] = hist.get(set1,0) + 1
#return hist
#def count_elements(seq) -> dict:
# """Tally elements from `seq`."""
# hist = {}
# for i in seq:
# hist[i] = hist.get(i, 0) + 1
# return hist
#from bs4 import BeautifulSoup
#import requests
#page_link="https://www.rediff.com/money/technology"
#page_response=requests.get(page_link,timeout=25)
#page_content=BeautifulSoup(page_response.content,"html.parser")
#Soup=BeautifulSoup(page_response.content,"html.parser")
#print("Rediff")
#for i in range(0,10):
# a=Soup.find_all('h3')[i].get_text()
## print(a)##
##
#a=Soup.find_all('h3')[1].get_text()
#print(a)
#<u class="StretchedBox" data-reactid="71"></u>
#https://www.rediff.com/money/technology
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment