[Chicago] constant length string manipulation

Cosmin Stejerean cstejerean at gmail.com
Sun Dec 2 07:14:06 CET 2007


It's cheating. What if he wanted 10 instead of 5? Hardcoding spaces is  
a bad idea.

Cosmin Stejerean (m)


On Dec 1, 2007, at 9:29 PM, Carl Karsten <carl at personnelware.com> wrote:

> string concatenation is icky.
>
> you have too many 5s.
>
> the line is too long.
>
> your variables are too short.
>
> there are no comments.
>
> and it isn't OOP.
>
> Carl K
>
> Massimo Di Pierro wrote:
>> what's wrong with
>>
>> b=(a[:5]+'     ')[:5]
>>
>> Massimo
>>
>> On Nov 30, 2007, at 9:25 AM, Lukasz Szybalski wrote:
>>
>>> On Nov 29, 2007 3:29 PM, Cosmin Stejerean <cstejerean at gmail.com>
>>> wrote:
>>>> b.ljust(5)[:5]
>>> a='1234567890' or a='123'
>>> b=a.ljust(5)[:5]
>>>
>>> so I guess ljust will do.
>>> Thanks.
>>> Lucas
>>> _______________________________________________
>>> Chicago mailing list
>>> Chicago at python.org
>>> http://mail.python.org/mailman/listinfo/chicago
>>
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> http://mail.python.org/mailman/listinfo/chicago
>>
>>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago


More information about the Chicago mailing list