How to convert BeautifulSoup object to string

0 votes

Hi. I am doing web scraping and I have extracted some data from website using findall. Now I want to do some string operations on it. How can I convert the BeautifulSoup object to string?

Apr 4, 2019 in Python by Raj
24,261 views

1 answer to this question.

0 votes

You can do this by directly type casting it. See the code below:

for points in soup.find_all('div',{"class":"user-level"}):
    point = str(points.text)
    print(point)
answered Apr 4, 2019 by Ashu
Just the job Ashu, thanks.

Related Questions In Python

0 votes
1 answer

How to convert date string to date object in python?

Use this :-  >>> datetime.datetime.strptime('24052010', "%d%m%Y").date() datetime.date(2010, 5, 24) Hope ...READ MORE

answered Oct 22, 2018 in Python by Priyaj
• 58,140 points
10,094 views
+1 vote
2 answers

How to convert list to string

mylist = [1, 2, 3] ‘’.join(map(str, mylist)) ==> ...READ MORE

answered Aug 21, 2018 in Python by Omkar
• 69,150 points
221 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

answered Nov 12, 2018 in Python by Nymeria
• 3,540 points
30,509 views
0 votes
1 answer

How to convert an integer to a string using Python?

Here is an easy solution: def numberToBase(n, b): ...READ MORE

answered Nov 23, 2018 in Python by Nymeria
• 3,540 points

edited Dec 12, 2018 by Nymeria 310 views
0 votes
1 answer
0 votes
1 answer

How to parse html file to BeautifulSoup?

Hey. Refer to the following code: driver.get("link") html = ...READ MORE

answered Apr 2, 2019 in Python by Kirti
1,071 views
0 votes
1 answer
0 votes
1 answer

How to convert string into epoch time?

you are passing the parsed datetime object to ...READ MORE

answered Sep 22, 2018 in Python by SDeb
• 13,300 points
4,124 views
0 votes
1 answer

How to convert a Unicode string to string

It can be done in the following ...READ MORE

answered Oct 16, 2018 in Python by SDeb
• 13,300 points
443 views