list unpack trick?

Fredrik Lundh fredrik at
Sun Jan 23 01:54:31 EST 2005

Nick Coghlan wrote:

>> I am think more in the line of string.ljust(). So if we have a  list.ljust(length, filler), we 
>> can do something like
>>   name, value = s.split('=',1).ljust(2,'')
> Eh?
> Py> s.split('=',1).ljust(2,'')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> AttributeError: 'list' object has no attribute 'ljust'

I think the "if we have" was hypothetical.

I still don't see why the OP cannot just write a small helper and be
done with it, but then I don't know anything about how Python is
used, so I might be wrong ;-)


More information about the Python-list mailing list