On Saturday, November 18, 2017 at 7:28:56 AM UTC-6, Skip Montanaro wrote:
> This is a test posting from the Usenet side of things. Looking to see if/when 
> it turns up in the gate_news logs on mail.python.org...

This is another test, though with a bit more Python content...

(python2) ~% python -c 'import this'
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

#!/usr/bin/env python

from __future__ import print_function

import csv
import glob
import os
import sys
import shutil

rows = csv.DictReader(open("manifest.dump", "rb"), 
                      fieldnames="sha1 domain path flag".split(),
                      delimiter='|')
for row in rows:
    if (row["path"].lower().endswith(".jpg") or
        row["path"].lower().endswith(".jpeg")):
        src = glob.glob("caa*/*/{}".format(row["sha1"]))
        if not src:
            print("not found:", row["path"], file=sys.stderr)
            continue
        dst = os.path.join("iPhone", row["path"])
        shutil.copy(src[0], dst)
        print(dst)
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to