python str方法之ljust、rjust、center
# -*- coding: cp936 -*- #python 27 #xiaodeng #str方法之ljust、rjust、center #http://www.runoob.com/python/att-string-rjust.html ''' 语法: str.rjust(width[, fillchar]) 参数: width -- 指定填充指定字符后中字符串的总长度. fillchar -- 填充的字符,默认为空格。 ''' #ljust左对齐 str='xiaodeng' print str.ljust(20,'-')#使用短横线做填充 #rjust右对齐 print str.rjust(20,'-') #center居中对齐 print str.center(20,'-')
    无语言基础,自学python所做的各种笔记,欢迎大牛指点.
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号