can't assign to literal

TheSaint fc14301589 at
Fri Jun 13 08:53:41 CEST 2008

On 15:11, giovedì 12 giugno 2008 Dennis Lee Bieber wrote:

> Word spaced line justification is only feasible if one is using a
> fixed width font and have a line length defined in "characters/line".


line= 'fixed width font and have a line length defined in "characters/line".'

lenLine= 78; newLine= ''; Words= line.split(' ')
lnWords= len(Words); norm_spc= lnWords-1; xtr_spc = lenLine -len(line)
lenChr= len(line)-norm_spc
numspc= (norm_spc+ xtr_spc)/ norm_spc
lstword= len(Words[norm_spc])
for spc in range(lnWords):
    if len(newLine)+lstword + numspc > lenLine : break
    newLine += Words[spc]+(' '* numspc)
    if xtr_spc:
       newLine += ' '; xtr_spc -= 1
print newLine+ ' '+ Words[spc]


In my mind it took me just few seconds :), but to get it working I spent
nearly *one* hour. I admit that my skill lacks of knowledge ])
Mailsweeper Home :

More information about the Python-list mailing list