Re: [Tutor] While until the end of a list

2017-03-14 Thread Toni Fuente via Tutor
> > for item in itertools.chain.from_iterable(chunk): >... > > will work, too, without the consumption of time and memory needed to build > the list. > Thank you Peter, yes it works as I wanted like that. ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] While until the end of a list

2017-03-14 Thread Peter Otten
Toni Fuente via Tutor wrote: > strings_chunk = list(itertools.chain.from_iterable(chunk)) > for item in strings_chunk: ... Note that if you are iterating over strings_chunk just once there is no need to create an in-memory list. for item in itertools.chain.from_iterable(chunk):

Re: [Tutor] While until the end of a list

2017-03-14 Thread Toni Fuente via Tutor
* Peter Otten <__pete...@web.de> [2017-03-13 19:57:38 +0100]: > > Toni Fuente via Tutor wrote: > > > Hi, > > > > I've got this script that goes through an httpd conf file, and gets the > > related bits of it for a site, and writes a new config with values that > > I am interested. The problem is

Re: [Tutor] While until the end of a list

2017-03-13 Thread Peter Otten
Toni Fuente via Tutor wrote: > Hi, > > I've got this script that goes through an httpd conf file, and gets the > related bits of it for a site, and writes a new config with values that > I am interested. The problem is that it finds the first chunk and > returns it, but I need to go to the end of

Re: [Tutor] While until the end of a list

2017-03-13 Thread Mats Wichmann
On 03/13/2017 10:48 AM, Toni Fuente via Tutor wrote: > * David Rock [2017-03-13 11:28:57 -0500]: >> You just need to make a list or a dict to store the information for each >> site, and add the results to it. If you use a list, it would be >> list.append(), for example. >> >> I don’t really fo

Re: [Tutor] While until the end of a list

2017-03-13 Thread Toni Fuente via Tutor
* David Rock [2017-03-13 11:28:57 -0500]: > > On Mar 13, 2017, at 10:54, Toni Fuente via Tutor wrote: > > > > Hi, > > > > I've got this script that goes through an httpd conf file, and gets the > > related bits of it for a site, and writes a new config with values that > > I am interested. The

Re: [Tutor] While until the end of a list

2017-03-13 Thread David Rock
> On Mar 13, 2017, at 10:54, Toni Fuente via Tutor wrote: > > Hi, > > I've got this script that goes through an httpd conf file, and gets the > related bits of it for a site, and writes a new config with values that > I am interested. The problem is that it finds the first chunk and > returns i

[Tutor] While until the end of a list

2017-03-13 Thread Toni Fuente via Tutor
Hi, I've got this script that goes through an httpd conf file, and gets the related bits of it for a site, and writes a new config with values that I am interested. The problem is that it finds the first chunk and returns it, but I need to go to the end of all chunks list, because there are also s