[Tutor] printing statement
bgailer at alum.rpi.edu
Fri Nov 4 16:56:18 CET 2005
At 10:02 PM 11/3/2005, Johan Geldenhuys wrote:
>Found it. This is what I was looking for:
> >>> print ('file'+'dir'.center(20))+('\n'+'='*15)
I am glad you found what you wanted. I'm sad that you did not tell us more
precisely what you wanted, as we could have steered you in that direction.
center() puts spaces to the right of dir. It that part of what you wanted,
or just a side effect.?
I'd find less () easier to read:
and 2 print statements even better:
>It's actually a string operator 'center(width)' that I was looking for.
>I saw the '%', but that is what I wanted to use.
Do you also appreciate the power of %? I hope you learn to use it also.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor