Skip to content

Commit

Permalink
Update Enumerate/Enumerate.md
Browse files Browse the repository at this point in the history
  • Loading branch information
suqi committed Dec 14, 2015
1 parent ed667ae commit cc4d32a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Enumerate/Enumerate.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 枚举
枚举是Python内置函数。它的用处很难在简单的一行中说明,但是大多数的新人,甚至一些高级程序员都没有意识到它。

枚举(```enumerate```)是Python内置函数。它的用处很难在简单的一行中说明,但是大多数的新人,甚至一些高级程序员都没有意识到它。

它允许我们遍历数据并自动计数,

Expand All @@ -9,8 +10,8 @@
for counter, value in enumerate(some_list):
print(counter, value)
```
不只如此,枚举也接受一些可选参数,这使它更有用。
This is not it. enumerate also accepts some optional arguments which make it even more useful.
不只如此,```enumerate```也接受一些可选参数,这使它更有用。

```python
my_list = ['apple', 'banana', 'grapes', 'pear']
for c, value in enumerate(my_list, 1):
Expand All @@ -22,9 +23,9 @@ for c, value in enumerate(my_list, 1):
(3, 'grapes')
(4, 'pear')
```
The optional argument allows us to tell enumerate from where to start the index. You can also create tuples containing the index and list item using a list. Here is an example:
这个可选参数允许我们定制从哪个数字开始枚举,你还可以用来创建包含索引的元组列表,

上面这个可选参数允许我们定制从哪个数字开始枚举。
你还可以用来创建包含索引的元组列表,
例如:

```python
Expand Down

0 comments on commit cc4d32a

Please sign in to comment.