python format输出换行_Python格式化带换行符的字符串

我以为我可以在几分钟内把东西拼凑在一起,但将文本格式化为列比我想象的要困难得多。但是这里是我到目前为止,仍然相当越野车...

class format_lines(object):

"""

1) some text goes 2nd column of text

here. But not its not really that

all text goes hard to add more text

in this column in a given format

2) another point

for text

"""

def __init__(self, *args, **kargs):

self.max_char_width = 30

self.gutter_width = 15

self.gutter = ' '*self.gutter_width

self.previous_line1 = None

self.previous_line2 = None

self.p1_index = 0

self.p2_index = 0

print args

print "len args = ", len(args)

if len(args) == 2:

print "Starting the test"

self.print_lines_(args[0], args[1])

def print_lines_(self, p1, p2):

while self.p1_ind

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值