Python Forum
how to seperate words from string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to seperate words from string
#2
input the entire string, strip and split
forexample, change:
print(section.find('span', {'class':'ListItemFull_text__1DqPn'}).get_text())
to
str1 = section.find('span', {'class':'ListItemFull_text__1DqPn'}.text.strip().split()
for word in str1:
    print(word)
# or
print(word[3]) # for the fourth word.
Reply


Messages In This Thread
how to seperate words from string - by zarize - Aug-28-2019, 04:58 PM
RE: how to seperate words from string - by Larz60+ - Aug-28-2019, 07:40 PM
RE: how to seperate words from string - by zarize - Aug-29-2019, 08:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pulling Specifics Words/Numbers from String bigpapa 2 819 May-01-2023, 07:22 PM
Last Post: bigpapa
  How to seperate dict value? ilknurg 2 1,393 Mar-11-2022, 10:48 AM
Last Post: perfringo
  Extract a string between 2 words from a text file OscarBoots 2 1,913 Nov-02-2021, 08:50 AM
Last Post: ibreeden
  Generate a string of words for multiple lists of words in txt files in order. AnicraftPlayz 2 2,880 Aug-11-2021, 03:45 PM
Last Post: jamesaarr
  Two separate dataframes, two seperate programs stylingpat 2 2,040 Apr-28-2021, 07:56 PM
Last Post: stylingpat
  Seperate output buffer matt_the_hall 2 2,405 Mar-15-2021, 08:44 PM
Last Post: matt_the_hall
  Replacing a words' letters in a string cananb 2 3,521 Dec-01-2020, 06:33 PM
Last Post: perfringo
  how to check if string contains ALL words from the list? zarize 6 7,367 Jul-22-2020, 07:04 PM
Last Post: zarize
  I want to filter out words with one letter in a string (pig latin translator) po0te 1 2,148 Jan-08-2020, 08:02 AM
Last Post: perfringo
  SQL connection in seperate file? Tommy 1 2,110 Jul-12-2019, 12:42 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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