Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40279

Re: Putting the loop inside of loop properly

Date 2013-03-01 18:40 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: Putting the loop inside of loop properly
References <af67d0e3-63ea-4c94-8c84-afc144361654@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2744.1362163249.2939.python-list@python.org> (permalink)

Show all headers | View raw


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 ):
[snip]

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']

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Putting the loop inside of loop properly Isaac Won <winefrog@gmail.com> - 2013-03-01 10:07 -0800
  Re: Putting the loop inside of loop properly MRAB <python@mrabarnett.plus.com> - 2013-03-01 18:40 +0000

csiph-web