can't assign to literal

TheSaint fc14301589 at icqmail.com
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".

===8<======8<======8<======8<======8<======8<======8<======8<======8<======8<

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]

===8<======8<======8<======8<======8<======8<======8<======8<======8<======8<

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 : http://it.geocities.com/call_me_not_now/index.html



More information about the Python-list mailing list