import requests
response = requests.get('http://?????/')
html = response.text
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, 'html.parser')
for tag in soup.select('tbody'):
print(tag.text)
I deleted the address because it's for internal use.
I want to print only two types of tags in tbody
and lmis
among all tags in tbody
.
When each is output, strong
is completely output, and then lmis
is completely output.
strong/lmis
I want to make it printable like this, and lmis
is a numeric format
I want to make it only derived if it is 1000
or higherThe theyn the
Help me
It's not an in-house network, but a site created to monitor the equipment we use.
I think I didn't explain well because I'm a Python beginner.
IFIA10 1,107 I want to derive these two. lmis is a time representation, so we want to print out only things that are more than 1000 hours.
print(tag.tr.td.font.strong.text)
print(tag.tr.td.lmis.text)
If you want to erase the comma and change it to int,
a = tag.tr.td.lmis.text
print(int(a.text.replace(',' , '')))
If you want to print more than 1000,
a = tag.tr.td.lmis.text
a = int(a.replace(',' , ''))
if a>=1000:
print(a)
I don't think I can catch td. Is there a reason why I used select?
print(soup.find('strong').text)
print(soup.find('lmis').text)
For tag~~ Do you want to try this after erasing the phrase?
© 2024 OneMinuteCode. All rights reserved.