[Tutor] Making table
alan.gauld at btinternet.com
Thu Mar 22 10:21:40 CET 2007
"Kent Johnson" <kent37 at tds.net> wrote in message
>> One final tip is to put the format string in a variable then use
>> in printing/writing the output ...
>> This has the advantage that you can build the format string
>> dynamically by examining the data first - eg the maximum
>> length of an entry.
> You don't need to build the format string dynamically to get control
> the maximum width. A neat trick is that if you use '*' for the
> width, the width will be read from the parameter list:
Good point, I usually forget that one...
However predefined format strings have other advantages too
- consistency for one thing. You can write output in multiple
places and be sure the format is consistent throughout.
More information about the Tutor