textwrap.fill algorithm? (Difference with vim)

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Apr 21 21:01:29 EDT 2017


Matěj Cepl wrote:
> On 2017-04-21, 21:54 GMT, Peter Otten wrote:
> 
>>It's not the algorithm, it's the width. Try 
>>textwrap.fill(text, 72).
> 
> I don’t understand. Why 72?

Because the first line including those words is 72 characters
long.

I don't know what vim is doing, but if you tell Python you
want lines no longer than 65 characters, it takes you at
your word.

-- 
Greg


More information about the Python-list mailing list