Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieve word from string
#1
Good day !

Based on the example below how could i print the word "fruits" ?
considering that it may change the position in the sentence and
considering that i have only "fr" as a search key



phrase = "I'm selling fruits and vegetables"

if "fr" in phrase:
...
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 584 Nov-08-2023, 12:18 AM
Last Post: evilcode1
  Isolate a word from a long string nicocorico 2 1,570 Feb-25-2022, 01:12 PM
Last Post: nicocorico
  change string in MS word Mr_Blue 8 3,425 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,556 Aug-12-2021, 04:25 PM
Last Post: palladium
  Python Speech recognition, word by word AceScottie 6 16,089 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  filter just with the string word jacklee26 2 2,434 Feb-03-2020, 03:25 PM
Last Post: snippsat
  Reverse the string word sneha 2 2,666 Dec-12-2019, 03:37 AM
Last Post: sneha
  Cannot Remove the Double Quotes on a Certain Word (String) Python BeautifulSoup soothsayerpg 5 7,170 Oct-27-2019, 09:53 AM
Last Post: newbieAuggie2019
  print a word after specific word search evilcode1 8 4,930 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019
  Need help to retrieve a particular string lokesh 3 1,779 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