Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Individually Add Punctuation (apostrophe) to a Printed Word?

I’m curious about adding punctuation without the need for a script/add-on, specifically for apostrophes since commas and ellipsis seem just fine by default.

So how would you individually add punctuation to the following code for the words "he’s" and "it’s":

print(‘I guess he’s not going to be there right now, it’s raining too hard…’)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’m brand new and assumed .split() was it, but it didn’t work.

>Solution :

strong textIf you are only hoping to print out the text, then the issue you are running into is likely because the apostrophes use the same characters as the ones that indicate you are creating a string. In that case you can change the string characters to be "double quotes" so that the apostrophe/single quote doesn’t cause issues.

print("I guess he's not going to be there right now, it's raining too hard...")

More generally you can also use an escape character to tell python that the internal apostrophes are not meant to denote the end of the string

print('I guess he\'s not going to be there right now, it\'s raining too hard...')

For more information on escape characters: https://www.w3schools.com/python/gloss_python_escape_characters.asp

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading