Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit45d105e

Browse files
Added zen.txt file for chapter 3
1 parent3d74f0e commit45d105e

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

‎03-dict-set/index0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
WORD_RE=re.compile('\w+')
1212

1313
index= {}
14-
withopen(sys.argv[1],encoding='utf-8')asfp:
14+
withopen('zen.txt',encoding='utf-8')asfp:
1515
forline_no,lineinenumerate(fp,1):
1616
formatchinWORD_RE.finditer(line):
1717
word=match.group()

‎03-dict-set/index_default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
WORD_RE=re.compile('\w+')
1313

1414
index=collections.defaultdict(list)# <1>
15-
withopen(sys.argv[1],encoding='utf-8')asfp:
15+
withopen('zen.txt',encoding='utf-8')asfp:
1616
forline_no,lineinenumerate(fp,1):
1717
formatchinWORD_RE.finditer(line):
1818
word=match.group()

‎03-dict-set/zen.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The Zen of Python, by Tim Peters
2+
3+
Beautiful is better than ugly.
4+
Explicit is better than implicit.
5+
Simple is better than complex.
6+
Complex is better than complicated.
7+
Flat is better than nested.
8+
Sparse is better than dense.
9+
Readability counts.
10+
Special cases aren't special enough to break the rules.
11+
Although practicality beats purity.
12+
Errors should never pass silently.
13+
Unless explicitly silenced.
14+
In the face of ambiguity, refuse the temptation to guess.
15+
There should be one-- and preferably only one --obvious way to do it.
16+
Although that way may not be obvious at first unless you're Dutch.
17+
Now is better than never.
18+
Although never is often better than *right* now.
19+
If the implementation is hard to explain, it's a bad idea.
20+
If the implementation is easy to explain, it may be a good idea.
21+
Namespaces are one honking great idea -- let's do more of those!

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp