I'm writing a script and one of the things it can do is retrieve dictionary definitions from online resources such as: en.wiktionary.org.
I'm using the tab character to prepend each string with an indent, so as to separate the dictionary definitions from the rest of the output, much like this quote box.
So currently it looks something like this:
Code:
Args = input('Define: ').split()
Word = Args[0]
Type = Args[1]
Many = Args[2]
print('\n\t'+ '\"'+Word+'\" '+Type)
print('\t\t'+Define(Word,Type,Many))
Which works fine, when the output is relatively short:
Input#1:
Define: dog verb 2
Output#1:
"dog" verb
1: To pursue with the intent to catch.
2: To fasten a hatch securely.
But not so much, when the text overflows onto the next line:
Input#2:
Define: dog noun 2
Output#2:
"dog" noun
1: A domesticated carnivorous mammal (Canis familiaris) related to the foxes
and wolves and raised in a wide variety of breeds.
2: Any of various carnivorous mammals of the family Canidae, such as the
dingo.
The desired output for that last one, would look more like this:
Output#3:
"dog" noun
1: A domesticated carnivorous mammal (Canis familiaris) related to the foxes
and wolves and raised in a wide variety of breeds.
2: Any of various carnivorous mammals of the family Canidae, such as the
dingo.
How could I programatically enforce that kind of formatting with dynamic content?