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
#6
(Oct-27-2019, 08:31 AM)soothsayerpg Wrote: Did you tried it out? If you try it out and remove all the special chars, that double-quote is the one who'll remain.

string1 = """There would be words like:
“Stay with Me” and “I’m not the Only One”,
"Latch"
“The Thrill of It All”
“Oh! Carol”
etc. etc. ..."""


print(''.join(characters for characters in string1 if characters not in '"“”'))
Output:
Output:
There would be words like: Stay with Me and I’m not the Only One, Latch The Thrill of It All Oh! Carol etc. etc. ... >>>
All the best,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  remove gilberishs from a "string" kucingkembar 2 309 Mar-15-2024, 08:51 AM
Last Post: kucingkembar
  Retrieve word from string knob 4 545 Jan-22-2024, 06:40 PM
Last Post: Pedroski55
  extract substring from a string before a word !! evilcode1 3 595 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,163 Jan-10-2023, 11:26 AM
Last Post: codinglearner
Smile please help me remove error for string.strip() jamie_01 3 1,262 Oct-14-2022, 07:48 AM
Last Post: Pedroski55
  [SOLVED] [BeautifulSoup] Why does it turn inserted string's brackets into </>? Winfried 0 1,570 Sep-03-2022, 11:21 PM
Last Post: Winfried
  [SOLVED] [BeautifulSoup] Turn select() into comma-separated string? Winfried 0 1,146 Aug-19-2022, 08:07 PM
Last Post: Winfried
  Remove a space between a string and variable in print sie 5 1,871 Jul-27-2022, 02:36 PM
Last Post: deanhystad
  Inserting line feeds and comments into a beautifulsoup string arbiel 1 1,227 Jul-20-2022, 09:05 AM
Last Post: arbiel
  How do I remove spurious "." from a string? Zuhan 7 2,133 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