[Tutor] positional output
Prasad, Ramit
ramit.prasad at jpmorgan.com
Fri Nov 11 00:17:58 CET 2011
>1) Using string formatting:
> >>> print("x{0}x{1}x".format(" " * 38, " " * 9))
You can specify alignment and padding with string formatting too. It just requires you to know the formatting mini-language.
>>> 'x{0:>40}x{1:^30}x{2:<40}'.format( 'right', 'center' , 'left' )
'x rightx center xleft '
http://docs.python.org/library/string.html
See 7.1.3.2 for examples
Ramit
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
--
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Tutor
mailing list