[Tutor] While until the end of a list

David Rock david at graniteweb.com
Mon Mar 13 12:28:57 EDT 2017


> On Mar 13, 2017, at 10:54, Toni Fuente via Tutor <tutor at python.org> 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 all chunks list, because
> there are also some chunks related to the same site that I need to
> collect (virtualhost *:80 and virtualhost:443). I was
> 
> I was thinking in a while loop in the find_chunk function that will go through
> all chunks and return the chunks that site is on, but I don't know how to
> construct it.

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 follow what you expect the output to be, though.
What do you want the results of running the script to look like?


—
David Rock
david at graniteweb.com






More information about the Tutor mailing list