Re: List problem

2012-12-03 Thread John Gordon
In <8c0a3ea9-2560-47eb-a9c7-3770e41fe...@googlegroups.com> subhabangal...@gmail.com writes: > Dear Group, > I have a list of the following pattern, > [("''", "''"), ('Eastern', 'NNP'), ('Army', 'NNP'), ('Commander', 'NNP'), (= > 'Lt', 'NNP'), ('Gen', 'NNP'), ('Dalbir', 'NNP'), ('Singh', 'NNP'),

Re: List problem

2012-12-03 Thread Neil Cerutti
On 2012-12-02, Thomas Bach wrote: > On Sun, Dec 02, 2012 at 04:16:01PM +0100, Lutz Horn wrote: >> >> len([x for x in l if x[1] == 'VBD']) >> > > Another way is > > sum(1 for x in l if x[1] == 'VBD') > > which saves the list creation. To also index them: vbdix = [i for i, a in emumerate(l) if a

Re: List problem

2012-12-02 Thread subhabangalore
On Sunday, December 2, 2012 9:29:22 PM UTC+5:30, Thomas Bach wrote: > On Sun, Dec 02, 2012 at 04:16:01PM +0100, Lutz Horn wrote: > > > > > > len([x for x in l if x[1] == 'VBD']) > > > > > > > Another way is > > > > sum(1 for x in l if x[1] == 'VBD') > > > > which saves the list creati

Re: List problem

2012-12-02 Thread Thomas Bach
On Sun, Dec 02, 2012 at 04:16:01PM +0100, Lutz Horn wrote: > > len([x for x in l if x[1] == 'VBD']) > Another way is sum(1 for x in l if x[1] == 'VBD') which saves the list creation. Regards, Thomas. -- http://mail.python.org/mailman/listinfo/python-list

Re: List problem

2012-12-02 Thread Lutz Horn
Him Am 02.12.2012 um 16:03 schrieb subhabangal...@gmail.com: > I have a list of the following pattern, > > [("''", "''"), ('Eastern', 'NNP'), ('Army', 'NNP'), ('Commander', 'NNP'), > ('Lt', 'NNP'), ('Gen', 'NNP'), ('Dalbir', 'NNP'), ('Singh', 'NNP'), ('Suhag', > 'NNP'), ('briefed', 'VBD'), ('th

List problem

2012-12-02 Thread subhabangalore
Dear Group, I have a list of the following pattern, [("''", "''"), ('Eastern', 'NNP'), ('Army', 'NNP'), ('Commander', 'NNP'), ('Lt', 'NNP'), ('Gen', 'NNP'), ('Dalbir', 'NNP'), ('Singh', 'NNP'), ('Suhag', 'NNP'), ('briefed', 'VBD'), ('the', 'DT'), ('Army', 'NNP'), ('chief', 'NN'), ('on', 'IN'),

Re: List Problem

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 10:56 AM, Littlefield, Tyler wrote: > I've not been following this thread fully, but why not just use x=list(y) to > copy the list? > The issue is that when you assign i=[1,2,3] and then j = i, j is just a > reference to i, which is why you change either and the other chang

Re: List Problem

2012-09-23 Thread Littlefield, Tyler
On 9/23/2012 3:44 PM, jimbo1qaz wrote: On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: I have a nested list. Whenever I make a copy of the list, changes in one affect the other, even when I use list(orig) or even copy the sublists one by one. I have to manually copy each cell

Re: List Problem

2012-09-23 Thread jimbo1qaz
On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: > I have a nested list. Whenever I make a copy of the list, changes in one > affect the other, even when I use list(orig) or even copy the sublists one by > one. I have to manually copy each cell over for it to work. > > Link to br

Re: List Problem

2012-09-23 Thread Steven D'Aprano
On Sun, 23 Sep 2012 14:31:48 -0700, jimbo1qaz wrote: > I have a nested list. Whenever I make a copy of the list, changes in one > affect the other, Then you aren't making a copy. py> first_list = [1, 2, 3] py> second_list = first_list # THIS IS NOT A COPY py> second_list.append() py> print

Re: List Problem

2012-09-23 Thread Dave Angel
On 09/23/2012 05:44 PM, jimbo1qaz wrote: > On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: >> I have a nested list. Whenever I make a copy of the list, changes in one >> affect the other, even when I use list(orig) or even copy the sublists one >> by one. I have to manually copy

Re: List Problem

2012-09-23 Thread Chris Angelico
On Mon, Sep 24, 2012 at 7:44 AM, jimbo1qaz wrote: > On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: >> I have a nested list. Whenever I make a copy of the list, changes in one >> affect the other, even when I use list(orig) or even copy the sublists one >> by one. I have to manu

Re: List Problem

2012-09-23 Thread Oscar Benjamin
On 23 September 2012 22:31, jimbo1qaz wrote: > I have a nested list. Whenever I make a copy of the list, changes in one > affect the other, even when I use list(orig) or even copy the sublists one > by one. I have to manually copy each cell over for it to work. > Link to broken code: http://jimbo

Re: List Problem

2012-09-23 Thread jimbo1qaz
On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: > I have a nested list. Whenever I make a copy of the list, changes in one > affect the other, even when I use list(orig) or even copy the sublists one by > one. I have to manually copy each cell over for it to work. > > Link to br

List Problem

2012-09-23 Thread jimbo1qaz
I have a nested list. Whenever I make a copy of the list, changes in one affect the other, even when I use list(orig) or even copy the sublists one by one. I have to manually copy each cell over for it to work. Link to broken code: http://jimbopy.pastebay.net/1090401 -- http://mail.python.org/ma

Re: list problem...

2010-09-29 Thread Shashwat Anand
28 Sep 2010 11:59:08 -0700, geremy condra wrote: > >> > >> >> On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: > >> >>> Hi all, > >> >>> Have been grappling with a list problem for hours... a = [2, 3, 4, > >> >>> 5,.] > >&g

Re: list problem...

2010-09-29 Thread Rog
28, 2010 at 11:44 AM, Rog wrote: >> >>> Hi all, >> >>> Have been grappling with a list problem for hours... a = [2, 3, 4, >> >>> 5,.] >> >>> b = [4, 8, 2, 6,.] >> >>> Basicly I am trying to place a[0], b[0] in a s

Re: list problem...

2010-09-29 Thread bruno.desthuilli...@gmail.com
On 29 sep, 14:17, Steven D'Aprano wrote: > On Tue, 28 Sep 2010 20:11:51 +0100, Rog wrote: > > On Tue, 28 Sep 2010 11:59:08 -0700, geremy condra wrote: > > >> On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: > >>> Hi all, > >>> Have been grapp

Re: list problem...

2010-09-29 Thread Steven D'Aprano
On Tue, 28 Sep 2010 20:11:51 +0100, Rog wrote: > On Tue, 28 Sep 2010 11:59:08 -0700, geremy condra wrote: > >> On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: >>> Hi all, >>> Have been grappling with a list problem for hours... a = [2, 3, 4, >>> 5,.] >

Re: list problem...

2010-09-28 Thread Shashwat Anand
On Wed, Sep 29, 2010 at 1:15 AM, rog wrote: > Shashwat Anand wrote: > > >> >> On Wed, Sep 29, 2010 at 12:14 AM, Rog > r...@pynguins.com>> wrote: >> >> Hi all, >>Have been grappling with a list problem for hours... >>a = [2, 3, 4,

Re: list problem...

2010-09-28 Thread Rog
On Tue, 28 Sep 2010 11:59:08 -0700, geremy condra wrote: > On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: >> Hi all, >> Have been grappling with a list problem for hours... a = [2, 3, 4, >> 5,.] >> b = [4, 8, 2, 6,.] >> Basicly I am trying to place a[0], b[

Re: list problem...

2010-09-28 Thread geremy condra
On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: > Hi all, > Have been grappling with a list problem for hours... > a = [2, 3, 4, 5,.] > b = [4, 8, 2, 6,.] > Basicly I am trying to place a[0], b[0] in a seperate list > IF a[2] and b[2] is present. > I have tried sets, zi

Re: list problem...

2010-09-28 Thread Shashwat Anand
On Wed, Sep 29, 2010 at 12:14 AM, Rog wrote: > Hi all, > Have been grappling with a list problem for hours... > a = [2, 3, 4, 5,.] > b = [4, 8, 2, 6,.] > Basicly I am trying to place a[0], b[0] in a seperate list > IF a[2] and b[2] is present. > You are not ex

list problem...

2010-09-28 Thread Rog
Hi all, Have been grappling with a list problem for hours... a = [2, 3, 4, 5,.] b = [4, 8, 2, 6,.] Basicly I am trying to place a[0], b[0] in a seperate list IF a[2] and b[2] is present. I have tried sets, zip etc with no success. I am tackling Euler projects with Python 3.1, with minimal

Re: Simple list problem that's defeating me!

2010-06-24 Thread Bruno Desthuilliers
Neil Webster a écrit : Thanks for the help so far. The background to the problem is that the lists come from reading a dbf file. The code that I am trying to write is to merge lines of the dbf based on the first column. So in my example there would be three lines: a 2 3 4 b 10 11 12 a 2 3 4 T

Re: Simple list problem that's defeating me!

2010-06-24 Thread Sion Arrowsmith
Mark Lawrence wrote: >On 22/06/2010 15:06, Neil Webster wrote: >> I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]. I >> need to combine the two lists that have the same first character in >> this example 'a'. In reality there are 656 lists within the list. >> [ ... ] >My simp

Re: Simple list problem that's defeating me!

2010-06-24 Thread Neil Webster
Thanks for the help so far. The background to the problem is that the lists come from reading a dbf file. The code that I am trying to write is to merge lines of the dbf based on the first column. So in my example there would be three lines: a 2 3 4 b 10 11 12 a 2 3 4 The expected output from t

Re: Simple list problem that's defeating me!

2010-06-22 Thread Bruno Desthuilliers
Neil Webster a écrit : Hi all, I've got a simple problem but it's defeated me and I was wondering if somebody could point out where I'm going wrong 1/ not posting working code (got a NameError) 2/ not posting the expected output 3/ not posting the actual output or offer an alternative soluti

Re: Simple list problem that's defeating me!

2010-06-22 Thread Mark Lawrence
On 22/06/2010 15:06, Neil Webster wrote: Hi all, I've got a simple problem but it's defeated me and I was wondering if somebody could point out where I'm going wrong or offer an alternative solution to the problem? I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]. I need to c

Re: Simple list problem that's defeating me!

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:06 AM, Neil Webster wrote: > I've got a simple problem but it's defeated me and I was wondering if > somebody could point out where I'm going wrong or offer an alternative > solution to the problem? Is this a hypothetical/mathematical problem of sorts ? If so, do you ha

Re: Simple list problem that's defeating me!

2010-06-22 Thread Xavier Ho
On 23 June 2010 00:06, Neil Webster wrote: > Hi all, > > I've got a simple problem but it's defeated me and I was wondering if > somebody could point out where I'm going wrong or offer an alternative > solution to the problem? > > I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]

Simple list problem that's defeating me!

2010-06-22 Thread Neil Webster
Hi all, I've got a simple problem but it's defeated me and I was wondering if somebody could point out where I'm going wrong or offer an alternative solution to the problem? I have a list of lists such as [[a,2,3,4],[b,10,11,12], [a,2,3,4]]. I need to combine the two lists that have the same fir

Re: Nested list problem - please...

2010-04-18 Thread Andreas Waldenburger
On Sat, 17 Apr 2010 13:31:54 -0700 Chris Rebert wrote: > On Sat, Apr 17, 2010 at 12:40 PM, Martin Hvidberg > wrote: > > I have this code, it builds up a data structure of nested lists, > > and filling data in them. My problem is that it seems that one of > > the lists SA[1] is not a list of uniq

Re: Nested list problem - please...

2010-04-17 Thread Chris Rebert
On Sat, Apr 17, 2010 at 12:40 PM, Martin Hvidberg wrote: > I have this code, it builds up a data structure of nested lists, and filling > data in them. > My problem is that it seems that one of the lists SA[1] is not a list of > unique instances but rather individual links to the same variable.

Nested list problem - please...

2010-04-17 Thread Martin Hvidberg
Dear list I have this code, it builds up a data structure of nested lists, and filling data in them. My problem is that it seems that one of the lists SA[1] is not a list of unique instances but rather individual links to the same variable. In the example below I assign 'X' to what I intended to

Re: List Problem

2008-12-09 Thread Robert Lehmann
On Tue, 09 Dec 2008 21:40:08 -0800, dongzhi wrote: > I have one problem for List. Like that: > > format='just "a" ""little"" test' > part = format.split('"') > print part > > the result is : ['just ', 'a', ' ', '', 'little', '', ' test'] > > the list part have 7 element. > > If I execute part[

Re: List Problem

2008-12-09 Thread dongzhi
On Dec 10, 2:00 pm, "James Mills" <[EMAIL PROTECTED]> wrote: > On Wed, Dec 10, 2008 at 3:40 PM, dongzhi <[EMAIL PROTECTED]> wrote: > > If I execute part[1], I have got  'a'. If I execute part[2], I have > > got ' '. But, if I execute part[1::2], I have got ['a', '', '']. I > > don't know why. Pleas

Re: List Problem

2008-12-09 Thread James Mills
On Wed, Dec 10, 2008 at 3:40 PM, dongzhi <[EMAIL PROTECTED]> wrote: > If I execute part[1], I have got 'a'. If I execute part[2], I have > got ' '. But, if I execute part[1::2], I have got ['a', '', '']. I > don't know why. Please tell me why. Perhaps you meant: part[1:2] pydoc list This will

List Problem

2008-12-09 Thread dongzhi
Hi All, I have one problem for List. Like that: format='just "a" ""little"" test' part = format.split('"') print part the result is : ['just ', 'a', ' ', '', 'little', '', ' test'] the list part have 7 element. If I execute part[1], I have got 'a'. If I execute part[2], I have got ' '. But, i

Re: List problem

2007-12-16 Thread Mel
Alan Bromborsky wrote: > I wish to create a list of empty lists and then put something in one of > the empty lists. Below is what I tried, but instead of appending 1 to > a[2] it was appended to all the sub-lists in a. What am I doing wrong? > > a = 6*[[]] > >>> a > [[], [], [], [], [], []] >

List problem

2007-12-16 Thread Alan Bromborsky
I wish to create a list of empty lists and then put something in one of the empty lists. Below is what I tried, but instead of appending 1 to a[2] it was appended to all the sub-lists in a. What am I doing wrong? a = 6*[[]] >>> a [[], [], [], [], [], []] >>> a[2].append(1) >>> a [[1], [1],

[python-list] Problem with SQLObject

2007-10-25 Thread Guillermo Heizenreder
I'm creating one aplicattion and I use SQLObject, but I have a little problem, when I try to create one table my aplicattion crash! :( Let me show you: [EMAIL PROTECTED]:~/Proyectos/ghhp/lib$ python Python 2.4.4 (#2, Apr 5 2007, 20:11:18) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on lin

Re: List problem

2006-08-25 Thread Georg Brandl
[EMAIL PROTECTED] wrote: > For example i write the following code in the Python command line; > list = ['One,Two,Three,Four'] > > Then enter this command, which will then return the following; > > ['One,Two,Three,Four'] This is already wrong. Assignments do not return anything. Georg -- h

Re: List problem

2006-08-24 Thread Larry Bates
[EMAIL PROTECTED] wrote: > For example i write the following code in the Python command line; > list = ['One,Two,Three,Four'] > > Then enter this command, which will then return the following; > > ['One,Two,Three,Four'] > > > Now the problem, reading through the Python tutorial's, it desc

Re: List problem

2006-08-24 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > For example i write the following code in the Python command line; > list = ['One,Two,Three,Four'] > > Then enter this command, which will then return the following; > > ['One,Two,Three,Four'] > > > Now the problem, reading through the Python tutorial's, it des

List problem

2006-08-24 Thread kevndcks
For example i write the following code in the Python command line; >>>list = ['One,Two,Three,Four'] Then enter this command, which will then return the following; ['One,Two,Three,Four'] Now the problem, reading through the Python tutorial's, it describe's that list's can sliced, concatenated a

Re: How to display name of elements in list? PROBLEM SOLVED.

2006-07-27 Thread cz
[EMAIL PROTECTED] wrote: > It looks like the PyTensor object *should* have .xx, .xy, etc > properties, but they may be accessible through a matrix, i.e. .t(i,j) Thanks to all of you for your help! The solution is easy: The tensor components have labels t11, t12,... Good guess ruibalp! -- http:

Re: list problem

2006-07-26 Thread placid
Thank you all for the replies, i now have a better solution. Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: list problem

2006-07-26 Thread Paul Rubin
"placid" <[EMAIL PROTECTED]> writes: > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > the second list contains strings that are identical to the first list, > so lets say the second list contains the following > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX6'] I think you meant list2 for the

Re: list problem

2006-07-26 Thread Gerard Flanagan
Gerard Flanagan wrote: > placid wrote: > > Hi all, > > > > I have two lists that contain strings in the form string + number for > > example > > > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > > > the second list contains strings that are identical to the first list, > > so lets say the sec

Re: list problem

2006-07-26 Thread Gerard Flanagan
placid wrote: > Hi all, > > I have two lists that contain strings in the form string + number for > example > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > the second list contains strings that are identical to the first list, > so lets say the second list contains the following > > >>> lis

Re: list problem

2006-07-26 Thread Simon Forman
placid wrote: > > But there may be other characters before XXX (which XXX is constant). A > better example would be, that string s is like a file name and the > characters before it are the absolute path, where the strings in the > first list can have a different absolute path then the second list

Re: list problem

2006-07-26 Thread zutesmog
placid wrote: > Hi all, > > I have two lists that contain strings in the form string + number for > example > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > the second list contains strings that are identical to the first list, > so lets say the second list contains the following > > >>> lis

Re: list problem

2006-07-26 Thread bearophileHUGS
placid: This may be a solution: l1 = ['acXXX1', 'XXX2', 'wXXX3', 'kXXX5'] l2 = [ 'bXXX1', 'xXXX2', 'efXXX3', 'yXXX6', 'zZZZ9'] import re findnum = re.compile(r"[0-9]+$") s1 = set(int(findnum.search(el).group()) for el in l1) s2 = set(int(findnum.search(el).group()) for el in l2) nmax = max(max(s

Re: list problem

2006-07-25 Thread Simon Forman
placid wrote: > Simon Forman wrote: > > placid wrote: > > > Hi all, > > > > > > I have two lists that contain strings in the form string + number for > > > example > > > > > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > > > > > the second list contains strings that are identical to the first

Re: list problem

2006-07-25 Thread placid
Simon Forman wrote: > placid wrote: > > Hi all, > > > > I have two lists that contain strings in the form string + number for > > example > > > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > > > the second list contains strings that are identical to the first list, > > so lets say the second

Re: list problem

2006-07-25 Thread Simon Forman
Simon Forman wrote: > Finally, you can say: > > for i in xrange(1,10): > s = "XXX1%04i" % i > if s not in list1 and s not in list2: > print s > > HTH, > ~Simon D'oh! Forgot to break. for i in xrange(1,10): s = "XXX1%04i" % i if s not in list1 and s not in list2: p

Re: list problem

2006-07-25 Thread Simon Forman
placid wrote: > Hi all, > > I have two lists that contain strings in the form string + number for > example > > >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] > > the second list contains strings that are identical to the first list, > so lets say the second list contains the following > > >>> list

list problem

2006-07-25 Thread placid
Hi all, I have two lists that contain strings in the form string + number for example >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5'] the second list contains strings that are identical to the first list, so lets say the second list contains the following >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', '

Re: list problem 4 newbie

2006-06-26 Thread manstey
Thanks very much. Deepcopy works fine, as does reversed(b). I thought I needed the index number but I didn't. Duncan Booth wrote: > manstey wrote: > > > for index in reversed(range(0,len(a)-1)): > >if '75' in b[index][1]: > > b[index][1].remove('75') > > b[index][1].append('99')

Re: list problem 4 newbie

2006-06-26 Thread Duncan Booth
manstey wrote: > for index in reversed(range(0,len(a)-1)): >if '75' in b[index][1]: > b[index][1].remove('75') > b[index][1].append('99') > What on earth is all that messing around in the for loop intended to do? If you want a range from len(a)-2 to 0 inclusive then just do it i

Re: list problem 4 newbie

2006-06-25 Thread vaibhav
Hi, if u check the id's of a and b lists and also its elements, you will obeserve that the id's of a and b have changed but id's of their elements have not changed. If you make a deep copy of the list a and then make your changes in that list, it shud work. this can be done using the copy module

list problem 4 newbie

2006-06-25 Thread manstey
I can't figure out why my code is not working. I thought I had the list copied correctly: Here is my code: a=[[u'HF', []], [u')F', [u'75']], [u'RE', []], [u'C', []]] b=a[:] for index in reversed(range(0,len(a)-1)): if '75' in b[index][1]: b[index][1].remove('75') b[i

Re: looping list problem

2005-08-17 Thread bruno modulix
Fredrik Lundh wrote: > Jon Bowlas wrote: (snip) >>But I get the following error- Line 5: Yield statements are not allowed. > > > umm. I might be missing something, but I cannot find any trace of that > error message in the Python interpreter source code. it doesn't even look > like a Python tr

RE: looping list problem

2005-08-16 Thread Jon Bowlas
Many thanks for your help, worked a treat Jon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 17:25 To: python-list@python.org Subject: RE: looping list problem Jon Bowlas wrote: > Incidentally I'm doing this

RE: looping list problem

2005-08-16 Thread Peter Otten
Jon Bowlas wrote: > Incidentally I'm doing this in zope. Many posters (including me) in this newsgroup don't do zope, so your best option is to ask on a zope-related mailing list. > I was hoping that this would loop through the elements in the list > returned by the hiddens function comparing th

RE: looping list problem

2005-08-16 Thread Jon Bowlas
uld ignore it and move onto the next one, but it doesn't seem to do anything. Any help would be appreciated. Incidentally I'm doing this in zope. Jon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 14:41 To

RE: looping list problem

2005-08-16 Thread Peter Otten
Jon Bowlas wrote: > Ok so I changed it to this: > > attobject = context.get_attobject() > navstring = context.get_uclattribute(attobject, 'ucl_navhide') > hiddennavelements = navstring.split(' ') > for hiddennavelement in hiddennavelements: > yield hiddennavelements > > But I get the followi

Re: looping list problem

2005-08-16 Thread Peter Hansen
Jon Bowlas wrote: > Ok so I changed it to this: > > attobject = context.get_attobject() > navstring = context.get_uclattribute(attobject, 'ucl_navhide') > hiddennavelements = navstring.split(' ') > for hiddennavelement in hiddennavelements: > yield hiddennavelements > > But I get the followi

Re: looping list problem

2005-08-16 Thread Fredrik Lundh
Jon Bowlas wrote: > Ok so I changed it to this: > > attobject = context.get_attobject() > navstring = context.get_uclattribute(attobject, 'ucl_navhide') > hiddennavelements = navstring.split(' ') > for hiddennavelement in hiddennavelements: >yield hiddennavelements > > But I get the following

Re: looping list problem

2005-08-16 Thread Paul McGuire
Well, you are returning prematurely from a for loop, so that is why you are only getting the first value. Its just like: for i in range(100): return i It doesn't matter how big the range is you are iterating over, you'll return on the first element and that's it. If what you want is the

RE: looping list problem

2005-08-16 Thread Jon Bowlas
5: Yield statements are not allowed. Any ideas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: 16 August 2005 13:44 To: python-list@python.org Subject: Re: looping list problem Jon Bowlas wrote: > attobject = context.get_

Re: looping list problem

2005-08-16 Thread Fredrik Lundh
Jon Bowlas wrote: > attobject = context.get_attobject() > navstring = context.get_uclattribute(attobject, 'ucl_navhide') > hiddennavelements = navstring.split(' ') > for hiddennavelement in hiddennavelements: >return hiddennavelement > > So the script 'get_attobject' basically looks for an ins

looping list problem

2005-08-16 Thread Jon Bowlas
HI all, I'm fairly new to python and programming in general so I was hoping someone here may be able to help me. Let me explain what the problem I'm having is: I am trying to parse the XML of an attributes object I created, this object has the structure outlined below. Everything is ok on the par