Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8868259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:13:45+00:00 2026-06-14T17:13:45+00:00

Alright, so I have unsuccessfully searched the website for parsing long strings (or sentences

  • 0

Alright, so I have unsuccessfully searched the website for parsing long strings (or sentences if you prefer) in Python. If there is a previously answered question of the same nature please redirect me to it! Anyways, Hi! I’m a beginner programmer (self-teaching Python using the internet) and I am looking for help with a (seemingly easy) problem. If you have any input for this problem please don’t hesitate to answer the question as you see fit but it would truly help me if you explained your solution(s) or coding examples to me with a bit of depth! Furthermore, my only idea to solve this problem is removing all puntuation using ascii values will one very long if statement then splitting the remaining text by using the spaces left over while appending them to a list. In an effort to save your time and for me to learn something new I’d rather not see the longest expression statement ever! Also please remember that this is a function that returns a list so don’t bother converting it (back) into a string or into a different data type such as a dictionary. Thanks in advance for any help you provide!

Without further ado here is the question:


Parse a string

Create a function that takes a string as input and returns a list of all words in the >string. It should remove all punctuation, replacing dashes with spaces.


Examples(calls):

    >>> parse("Listen, strange women lyin' in ponds distributin' swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.") 
   [Listen, strange, women, lyin, in, ponds, distributin, swords, is, no, basis, for, a, system, of, government, Supreme, executive, power, derives, from, a, mandate, from, the, masses, not, from, some, farcical, aquatic, ceremony] 
    >>> parse("What... is the air-speed velocity of an unladen swallow?") 
    [What, is, the, air, speed, velocity, of, an, unladen, swallow]

I am so sorry for the run on code length! Anyways I think you all understand what is supposed to be done just from the question itself. Any suggestions or unique/effective solutions are definitely welcomed! – Winkleson

P.s. So sorry for the run-on sentences and "Walls of Texts". I am a bit chatty… Anyways thanks again for any help!

PLEASE NOTE THAT THE OUTPUT IS NOT A LIST! FURTHERMORE SYMBOLS CANNOT BE INCLUDED IN THE ANSWER! PLEASE DON’T FORGET THAT! THANKS AGAIN FOR YOUR HELP! SORRY FOR THE INCONVIENECE THE AUTHOR OF THE QUESTION MISMATCHED THE ANSWER!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:13:46+00:00Added an answer on June 14, 2026 at 5:13 pm

    I would suggest using a regular expression, like this

    import re
    
    re.findall(r'[a-zA-Z]+',input_string)
    

    Or for doing multiple strings, compile the regex first

    regexp=re.compile(r'[a-zA-Z]+')
    regexp.findall(test)
    

    Essentially, this is asking for all of the characters that contain letters, grouped by characters. If you wanted to, say, include contracted words, you could just add ‘ to the expression, like this:

    re.findall(r'[a-zA-Z']+',input_string)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright simple question I have integriters like 5 188 4634 And they all need
Alright, Question #1: well i have a richtextbox, and id like to add emotions
Alright I have a question that seems simple but I haven't been able to
Alright, I have tried a bunch of times the python setup.py install command from
Alright so far I have created a list containing a long list of words
Alright so far I have created a list containing a long list of words
Alright i have been searching for days but there is no example of what
Alright, I have searched a lot and I get a lot of Android dev
Alright, I have an embarrassingly simple question that hopefully has an embarrassingly simple answer.
Alright have been working to switch to jQuery 1.7's new and improved .on() function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.