[Tutor] While until the end of a list

Mats Wichmann mats at wichmann.us
Mon Mar 13 13:12:25 EDT 2017

On 03/13/2017 10:48 AM, Toni Fuente via Tutor wrote:
> * David Rock <david at graniteweb.com> [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 follow what you expect the output to be, though.
>> What do you want the results of running the script to look like?
> At the moment I am writing to a file:
>         with open("/tmp/afm/etc/httpd/conf.d/vhosts.inc/%s.conf" % site, "a") as cfile:
>             cfile.write("".join(new_config))
> and whenever finds the first chunck in total_configs.txt writes to it, and
> doesn't carry on searching for other chunks that contain "site", foo.com, so it
> won't find the site in port 80.

There's an existing project you might be able to make use of...


it's somewhere on github, I think the PyPi page links to that.

More information about the Tutor mailing list