Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieve word from string
#3
There are several ways to do this. One is to use string find() method and then check where the next space is. Another way is to use regular expressions, which will be faster if you have a large text and you want to find all occurrences. You can also try if 'fr' in your_sentence code in case you just want to check membership.
Reply


Messages In This Thread
Retrieve word from string - by knob - Jan-21-2024, 12:06 AM
RE: Retrieve word from string - by rob101 - Jan-21-2024, 03:29 AM
RE: Retrieve word from string - by sgrey - Jan-21-2024, 05:57 AM
RE: Retrieve word from string - by deanhystad - Jan-21-2024, 06:22 PM
RE: Retrieve word from string - by Pedroski55 - Jan-22-2024, 06:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  extract substring from a string before a word !! evilcode1 3 642 Nov-08-2023, 12:18 AM
Last Post: evilcode1
  Isolate a word from a long string nicocorico 2 1,602 Feb-25-2022, 01:12 PM
Last Post: nicocorico
  change string in MS word Mr_Blue 8 3,511 Sep-19-2021, 02:13 PM
Last Post: snippsat
Question Problem: Check if a list contains a word and then continue with the next word Mangono 2 2,593 Aug-12-2021, 04:25 PM
Last Post: palladium
  Python Speech recognition, word by word AceScottie 6 16,181 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  filter just with the string word jacklee26 2 2,478 Feb-03-2020, 03:25 PM
Last Post: snippsat
  Reverse the string word sneha 2 2,699 Dec-12-2019, 03:37 AM
Last Post: sneha
  Cannot Remove the Double Quotes on a Certain Word (String) Python BeautifulSoup soothsayerpg 5 7,223 Oct-27-2019, 09:53 AM
Last Post: newbieAuggie2019
  print a word after specific word search evilcode1 8 5,008 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019
  Need help to retrieve a particular string lokesh 3 1,801 May-28-2019, 05:07 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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