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


Groups > comp.lang.python > #35857

Re: Question about nested loop

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <winefrog@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'append': 0.07; 'elegant': 0.07; 'pretend': 0.07; 'subject:Question': 0.07; 'advice.': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'anyway': 0.11; "'c'": 0.16; "(i'm": 0.16; 'columns': 0.16; 'increment': 0.16; 'incremented': 0.16; 'repetition': 0.16; 'wrote:': 0.17; 'issue.': 0.20; '31,': 0.22; 'cc:2**0': 0.23; 'monday,': 0.23; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'raw': 0.27; 'arrays': 0.29; 'loop,': 0.29; 'maybe': 0.29; 'december': 0.32; 'could': 0.32; 'print': 0.32; 'another': 0.33; 'agree': 0.34; 'skip:b 20': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'list': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'thank': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'your': 0.60; 'you.': 0.61; 'solve': 0.62; 'more': 0.63
Newsgroups comp.lang.python
Date Mon, 31 Dec 2012 14:02:52 -0800 (PST)
In-Reply-To <mailman.1497.1356956797.29569.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=129.118.0.5; posting-account=DOyQBwoAAADIEpwWr89vk1x7RGFM33oc
References <db8edd31-78f2-4e8c-a6bd-37e1e83ff2ee@googlegroups.com> <mailman.1497.1356956797.29569.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 129.118.0.5
MIME-Version 1.0
Subject Re: Question about nested loop
From Isaac Won <winefrog@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc Python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.1498.1356991376.29569.python-list@python.org> (permalink)
Lines 55
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356991376 news.xs4all.nl 6901 [2001:888:2000:d::a6]:43287
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35857

Show key headers only | View raw


On Monday, December 31, 2012 5:25:16 AM UTC-6, Gisle Vanem wrote:
> "Isaac Won" <winefrog@gmail.com> wrote:
> 
> 
> 
> > while c < 10:
> 
> >        c = c + 1
> 
> > 
> 
> >        for  columns in ( raw.strip().split() for raw in f ):
> 
> > 
> 
> > 
> 
> >                b.append(columns[c])
> 
> > 
> 
> >        y = np.array(b, float)
> 
> >        print c, y
> 
> > 
> 
> > 
> 
> > I thought that  can get the arrays of the columns[5] to [10],
> 
> > but I only could get repetition of same arrays of columns[5].
> 
> 
> 
> I don't pretend to know list comprehension very well, but 
> 
> 'c' isn't incremented in the inner loop ( .. for raw in f). 
> 
> Hence you only append to columns[5].
> 
> 
> 
> Maybe you could use another 'd' indexer inside the inner-loop?
> 
> But there must a more elegant way to solve your issue. (I'm a
> 
> PyCommer myself).
> 
> 
> 
> --gv

Thank you for your advice.
 I agree with you and tried to increment in inner loop, but still not very succesful. Anyway many thanks for you.

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


Thread

Question about nested loop Isaac Won <winefrog@gmail.com> - 2012-12-31 02:02 -0800
  Re: Question about nested loop Gisle Vanem <gvanem@broadpark.no> - 2012-12-31 12:25 +0100
    Re: Question about nested loop Isaac Won <winefrog@gmail.com> - 2012-12-31 14:02 -0800
    Re: Question about nested loop Isaac Won <winefrog@gmail.com> - 2012-12-31 14:02 -0800
  Re: Question about nested loop Hans Mulder <hansmu@xs4all.nl> - 2012-12-31 13:59 +0100
    Re: Question about nested loop Isaac Won <winefrog@gmail.com> - 2012-12-31 14:11 -0800

csiph-web