Python Forum
Cannot Remove the Double Quotes on a Certain Word (String) Python BeautifulSoup
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot Remove the Double Quotes on a Certain Word (String) Python BeautifulSoup
#5
In Python 3 when there is no b(bytes) b'hello'.
Then all text is Unicode.
So what see is what you get,what i mean bye that is that you can just copy the smart quotes and replace.
>>> p = paragraphs[0].text
>>> print(p)
With hits such as “Stay with Me” and “I’m not the Only One”, Sam Smith has become one of UK’s hottest singers.
>>> 
>>> # Now is just copy smart quotes for line over and replace
>>> print(p.replace('“', '').replace('”', ''))
With hits such as Stay with Me and I’m not the Only One, Sam Smith has become one of UK’s hottest singers.
Also using .text is shorter that get_text(),they do the same.
Reply


Messages In This Thread
RE: Cannot Remove the Double Quotes on a Certain Word (String) Python BeautifulSoup - by snippsat - Oct-27-2019, 09:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  remove gilberishs from a "string" kucingkembar 2 279 Mar-15-2024, 08:51 AM
Last Post: kucingkembar
  Retrieve word from string knob 4 499 Jan-22-2024, 06:40 PM
Last Post: Pedroski55
  extract substring from a string before a word !! evilcode1 3 549 Nov-08-2023, 12:18 AM
Last Post: evilcode1
  Need help on how to include single quotes on data of variable string hani_hms 5 2,054 Jan-10-2023, 11:26 AM
Last Post: codinglearner
Smile please help me remove error for string.strip() jamie_01 3 1,211 Oct-14-2022, 07:48 AM
Last Post: Pedroski55
  [SOLVED] [BeautifulSoup] Why does it turn inserted string's brackets into </>? Winfried 0 1,536 Sep-03-2022, 11:21 PM
Last Post: Winfried
  [SOLVED] [BeautifulSoup] Turn select() into comma-separated string? Winfried 0 1,125 Aug-19-2022, 08:07 PM
Last Post: Winfried
  Remove a space between a string and variable in print sie 5 1,800 Jul-27-2022, 02:36 PM
Last Post: deanhystad
  Inserting line feeds and comments into a beautifulsoup string arbiel 1 1,191 Jul-20-2022, 09:05 AM
Last Post: arbiel
  How do I remove spurious "." from a string? Zuhan 7 2,071 Apr-12-2022, 02:06 PM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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