Putting the loop inside of loop properly

MRAB python at mrabarnett.plus.com
Fri Mar 1 19:40:49 CET 2013

On 2013-03-01 18:07, Isaac Won wrote:
> I just would like to make my previous question simpler and I bit adjusted my code with help with Ulich and Chris.
> The basic structure of my code is:
> for c in range(5,25):
>          for columns in ( raw.strip().split() for raw in f ):

When you're using .split() with no argument (split on any whitespace),
you don't need to use .strip() with no argument (strip any whitespace):

 >>> ' foo  bar  '.strip().split()
['foo', 'bar']
 >>> ' foo  bar  '.split()
['foo', 'bar']

More information about the Python-list mailing list