[Tutor] Pythonese/Efficiency/Generalese critique please

Javier Ruere javier at ruere.com.ar
Sun Jun 5 03:15:01 CEST 2005


Kent Johnson wrote:
> Javier Ruere wrote:
> 
>>for i in range(alvl, clvl):
>>     csvline = csvline + '"' + pl[i] + '",'
>>
>>should be replaced by something like the following:
>>
>>cvsline += '"' + pl[alvl:clvl].join('",')
> 
> 
> or maybe more like this:
> cvsline += '"' + '",'.join(pl[alvl:clvl]) + '",'
> 
> though if alvl == clvl this will output an empty cell.
> 
> Kent

   True! I should start programming in Python again. :)

Javier



More information about the Tutor mailing list