>
> 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
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):
* 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
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
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
* 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
> 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
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