tags:

views:

31

answers:

3

i have a variable:

row='saint george 1739 1799 violin concerti g 029 039 050 symphonie concertante for two violins g 024 bertrand cervera in 024 039 christophe guiot in 024 029 and thibault vieux violin soloists orchestre les archets de paris'

i am doing this:

textwrap.fill(row,55)

i would like some list line to have line[0]='saint george 1739 1799 violin concerti g 029 039 050' and line[1]='symphonie concertante for two violins g 024 bertrand' etc.....

please help me with this conversion from textwrap into a list

please note that textwrap breaks things up by \n

+1  A: 

use textwrap.wrap instead of textwrap.fill

TokenMacGuy
+1  A: 

textwrap.wrap returns a list. Why not use that?

textwrap.fill(text, ...) is the equivalent of "\n".join(wrap(text, ...)). As explained in the docs.

sdolan
+1  A: 

You can just split it using e.g.

textwrap.fill(row, 55).split('\n')

or use textwrap.wrap instead.

intuited