I am doing web scraping using selenium.
I can get the information I want, but I want to change the appearance of the output characters, but I can't change it properly.
Specifically, I want to display "6 people" that have been divided so that 6 people are lined up side by side.
It will be acquired like the image below.
The HTML structure is as shown in the image.
The code looks like this:
from selenium import webdriver from bs4 import BeautifulSoup driver_path="path" Operate #Chrome driver = webdriver.Chrome(driver_path) driver.get(url) html = driver.page_source.encode('utf-8') # Parse so that it can be handled by Beautiful Soup soup = BeautifulSoup(html, "html.parser") msg = soup.select_one("#app>div>div>div.mainContainer>div>div>div.row.DataBlock>div:nth-child(10)>div>header>div>div:nth-child(3 )>span").text print(msg)
Applicable source code
What I tried
Please describe what you have tried for the problem here.Supplemental information (FW/tool version, etc.)
Answer # 1
I'm not sure what I did,
"6 people"If you want to get the data
import re msg = re.sub(r"\s","",msg)
- i want to get new comments one after another with python scraping what is the quickest way to do this?
- python - i don't know how to change the number after the random number is generated
- i want to exit the command prompt after executing a python (selenium) program
- python - [django] i want to display the date after the specified number of days
- php - i want to change the query after a certain number of times with a wordpress subloop
- [swift] i want to change the variable type after inheritance
- python: how to change the print format of the answer obtained with return
- python scraping
- i want to change the display format of date by using regular expression in python
- python - i want to do web scraping and create a dictionary
- python 3x - scraping only elements within tabs
- python - i want to change a part of the completed source code
- python - i want to retrieve the contents of the href tag from the html of the specified url (scraping)
- i want to add elements after python list type declaration, but append results in typeerror
- python 3x - i want to change the state of a widget created with the python3 tkinter loop
- python - is it ideal that cms and scraping language should be unified?
- scraping in python:'nonetype' object has no attribute'gettext'
- python - the hyperparameter search results change every time ramdom seed is not working
- python doesn't work properly with vs code after changing to mac os catalina (version 10155)
- tell me about python iteration statements
- python - centos7 google chrome error (i want to scrape with selenium)
- python - i want to let selenium click the pull-down menu of vue's combobox
- python - i cannot scrape post communication
- [python] tag acquisition for image scraping
- python - scraping multiple urls in a loop
- python flow control break statement
- about python regular expressions