Q:

Output string to look like newspaper article in Python

I am trying to output a string in the console so that, at a fixed line length, it cuts off and continues the string on a new line - to give the string a newspaper-article look.
This, I have acheived. However, I wish to implement a system so that words are not cut off in the middle, disrupting the flow of reading. I would instead like a hyphen inserted at eand of line.
This is the output I currently have:

This is the sort of output I wish to have:

I have tried changing my code on line 9 so it reads as the following, but that results in hyphens being placed at the end of every line -- which isn't what I want.
if(outStr[i+1] == " "):

How do I alter my code so that it creates the output I would like? This function has to be able to work with any long string, as it will be used multiple times as part of a larger program.
This is the code that I have, written in Python 3.6.5:
lorumIpsum = "Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source."

def OutputStringToBook(outStr):
    # Take each character
    for i in range(len(outStr)):
        # If the character is at the designated line end
        if (i % 30 == 0):
            # If the next character is not a space
            if(outStr[i+1] != " "):
                print()
            else:
                print("-") 
            print(outStr[i], end="")
        else:
            print(outStr[i], end="")
    #time.sleep(0.01)
OutputStringToBook(lorumIpsum)

A:

To make it look like a newspaper, you should use a proper hyphenation algorithm.
The PyHyphen library includes the hyphenation dictionaries used in libreoffice and supports multiple languages (the default language is en_US).
# pip install pyhyphen
from hyphen import Hyphenator
from textwrap2 import wrap
english = Hyphenator('en_US')
print('\n'.join(wrap(lorem_text, width=20, use_hyphenator=english)))

The output will look like this. Note that some lines are shorter than 20 characters. Hyphens are only used in long words, and follows the language specific rules for hyphenation.

Contrary to popular
belief, Lorem Ipsum
is not simply random
text. It has roots
in a piece of clas-
sical Latin litera-
ture from 45 BC,
making it over 2000
years old.

