I'm trying to format some strings for output on the command-line, report style, and am looking for the easiest method to format a string such that I can get automatic paragraph formatting.
In perlform formatting is done through the "format" function
format Something =
Test: @<<<<<<<< @||||| @>>>>>
$str, $%, '$' . int($num)
.
$str = "widget";
$num = $cost/$quantity;
$~ = 'Something';
write;
Variations of the perlform allow texts to be wrapped cleanly, useful for help screens, log reports and such.
Is there a python equivalent? Or a reasonable hack that I could write using Python's new string format function?
Example output I'd like:
Foobar-Title Blob
0123 This is some long text which would wrap
past the 80 column mark and go onto the
next line number of times blah blah blah.
hi there dito
something more text here. more text here. more text
here.