|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to align
Hi i wrote a code to display all the files in a directory it works fine but i don't know how to left or right align them can someone help me ???
or to wait for a key to continue after 20 lines Code:
import sys
import os
print os.getcwd()
as=os.listdir('')
print " List of All .py Files in Python23 DIR "
print
as.sort()
for i in as:
print " ", i ,
|
|
#2
|
||||
|
||||
|
Here you go: 2.3.6.2 String Formatting Operations in the Python Library Reference.
Grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#3
|
||||
|
||||
|
You can also use the rjust() and ljust() string methods which will padd the string to a desired lengh on either side (depending on which method you use).
Quote:
Heres the link to the page grim sugested if you havnt found it already. http://www.python.org/doc/current/l...eq-strings.html Hope this helps, Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > How to align |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|