align « Format « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » Format » align 

1. How do I right-align my text in Python?    stackoverflow.com

I have some data that I am displaying in 3 column format, of the form "key: value key: key: value key: value". Here's an example:

p: 1    ...

2. Why are python strings left aligned in format with specified width?    stackoverflow.com

While thinking of a way to pretty print table header i found that integers are right aligned by default, but strings are left aligned. For example:

>>> for i in (1,'x',0.0):
...   ...

3. Python: Format output string, right alignment    stackoverflow.com

I am processing a text file containing coordinates x,y,z

     1      128  1298039
123388        0  ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.