Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Get text without inner tags text in selenium

data = '''<td height="21" class="xl7024240">Other Financial Services<font class="font711087"><sup>1</sup></font></td>'''

from bs4 import BeautifulSoup
import bs4

soup = BeautifulSoup(data, 'html.parser')

external_span = soup.find('td')

text = []
for x in external_span:
    if isinstance(x, bs4.element.NavigableString):
        text.append(x.strip())
print(" ".join(text))
Comment

PREVIOUS NEXT
Code Example
Python :: extract decimal number from string python 
Python :: split list python percent 
Python :: python use math 
Python :: Multiple Function in python with input method 
Python :: aiohttps 
Python :: python format new 
Python :: python screeninfo 
Python :: python collections counter methods 
Python :: how to make a python file delete itself 
Python :: sqlite3 python parameterized query insert into 
Python :: python loops 
Python :: Python Join Lists 
Python :: how to iterate through a list of numbers in python 
Python :: python split range into n groups 
Python :: views.py 
Python :: python get pattern from string 
Python :: how to remove last item from list python 
Python :: font tkinter combobox 
Python :: python binary float 
Python :: python string upper method 
Python :: upper python python.org 
Python :: django csrf failed 
Python :: django swagger 
Python :: remove str to set in python 
Python :: return function in python 
Python :: guessing game python 
Python :: open multiple plots python 
Python :: how to write a function in python 
Python :: list remove method in python 
Python :: python import list from py file 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =