diff --git a/03-dict-set/index.py b/03-dict-set/index.py index 3eac1fb..760dba1 100644 --- a/03-dict-set/index.py +++ b/03-dict-set/index.py @@ -11,7 +11,7 @@ WORD_RE = re.compile('\w+') index = {} -with open(sys.argv[1], encoding='utf-8') as fp: +with open('zen.txt', encoding='utf-8') as fp: for line_no, line in enumerate(fp, 1): for match in WORD_RE.finditer(line): word = match.group() diff --git a/03-dict-set/index0.py b/03-dict-set/index0.py index e1fa28f..d591e7c 100644 --- a/03-dict-set/index0.py +++ b/03-dict-set/index0.py @@ -11,7 +11,7 @@ WORD_RE = re.compile('\w+') index = {} -with open(sys.argv[1], encoding='utf-8') as fp: +with open('zen.txt', encoding='utf-8') as fp: for line_no, line in enumerate(fp, 1): for match in WORD_RE.finditer(line): word = match.group() diff --git a/03-dict-set/index_default.py b/03-dict-set/index_default.py index 521b2d5..680680b 100644 --- a/03-dict-set/index_default.py +++ b/03-dict-set/index_default.py @@ -12,7 +12,7 @@ WORD_RE = re.compile('\w+') index = collections.defaultdict(list) # <1> -with open(sys.argv[1], encoding='utf-8') as fp: +with open('zen.txt', encoding='utf-8') as fp: for line_no, line in enumerate(fp, 1): for match in WORD_RE.finditer(line): word = match.group() diff --git a/03-dict-set/zen.txt b/03-dict-set/zen.txt new file mode 100644 index 0000000..048a1a3 --- /dev/null +++ b/03-dict-set/zen.txt @@ -0,0 +1,21 @@ +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! \ No newline at end of file