Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing Sentences (or other longer strings) in Python (ProblemSetQuestion) How to proceed?
    primarykey
    data
    text
    <p>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!</p> <p>Without further ado here is the question:</p> <hr> <blockquote> <p><strong>Parse a string</strong></p> <p>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.</p> </blockquote> <hr> <p>Examples(calls):</p> <pre><code> &gt;&gt;&gt; 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] &gt;&gt;&gt; parse("What... is the air-speed velocity of an unladen swallow?") [What, is, the, air, speed, velocity, of, an, unladen, swallow] </code></pre> <hr> <p>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> <p>P.s. So sorry for the run-on sentences and "Walls of Texts". I am a bit chatty... Anyways thanks again for any help!</p> <p><strong>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!</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload