Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help, simply grab web content
#1
import requests
from bs4 import BeautifulSoup
res=requests.get('http://127.0.0.1:8887/4.9/ActualCombat.html')
soup=BeautifulSoup(res.text,'html.parser')
print(soup.prettify())

test=soup.select('')#Fill in here, you can get the two characters of ‘home’ in the webpage
print(test)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>nav</title>
<script src="js/jquery-3.3.1.js"></script>
<link rel="stylesheet" href="css/bootstrap.css">
<script src="js/bootstrap.js"></script>
<style>
span{
margin-left: 6px;
}
img{
margin-left: 2%;
float: left;
width:130px;

}

</style>
</head>
<body>
<div id="test">
<nav class="nav navbar-inverse" role="navigation">
<div>
<img class="navbar-header" src="images/logo.png">
</div>
<ul class="nav navbar-nav">
<li><a class="active" href="#">home</a></li>
</ul>
</nav>
</div>
</body>
</html>

solved
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to grab a table off a webpage you are already logged into? cubangt 0 1,180 Mar-02-2022, 10:10 PM
Last Post: cubangt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020