From 3834ef45902148226072a0132ecfd28043144485 Mon Sep 17 00:00:00 2001 From: LiuTingwei Date: Mon, 3 Feb 2020 00:49:44 +0800 Subject: [PATCH] =?UTF-8?q?list=E5=85=B3=E9=94=AE=E5=AD=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Article/PythonBasis/python7/3.md | 16 ++++++++-------- README.md | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Article/PythonBasis/python7/3.md b/Article/PythonBasis/python7/3.md index 77fb5db..177ba14 100644 --- a/Article/PythonBasis/python7/3.md +++ b/Article/PythonBasis/python7/3.md @@ -1,4 +1,4 @@ -# 三、lsit 生成式(列表生成式) # +# 三、list 生成式(列表生成式) # ## 1、创建 list 的方式 ## @@ -48,7 +48,7 @@ print('\n'.join([' '.join ('%dx%d=%2d' % (x,y,x*y) for x in range(1,y+1)) for y ## 2、list 生成式的创建 ## -首先,lsit 生成式的语法为: +首先,list 生成式的语法为: ```python [expr for iter_var in iterable] @@ -65,8 +65,8 @@ print('\n'.join([' '.join ('%dx%d=%2d' % (x,y,x*y) for x in range(1,y+1)) for y ```python # -*- coding: UTF-8 -*- -lsit1=[x * x for x in range(1, 11)] -print(lsit1) +list1=[x * x for x in range(1, 11)] +print(list1) ``` 输出的结果: @@ -79,8 +79,8 @@ print(lsit1) ```python # -*- coding: UTF-8 -*- -lsit1= [x * x for x in range(1, 11) if x % 2 == 0] -print(lsit1) +list1= [x * x for x in range(1, 11) if x % 2 == 0] +print(list1) ``` 输出的结果: @@ -95,8 +95,8 @@ print(lsit1) ```python # -*- coding: UTF-8 -*- -lsit1= [(x+1,y+1) for x in range(3) for y in range(5)] -print(lsit1) +list1= [(x+1,y+1) for x in range(3) for y in range(5)] +print(list1) ``` 输出的结果: diff --git a/README.md b/README.md index da008c9..a9df880 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ IT 行业相对于一般传统行业,发展更新速度更快,一旦停止 * [迭代器和生成器](/Article/PythonBasis/python7/Preface.md) - [迭代](/Article/PythonBasis/python7/1.md) - [Python 迭代器](/Article/PythonBasis/python7/2.md) - - [lsit 生成式(列表生成式)](/Article/PythonBasis/python7/3.md) + - [list 生成式(列表生成式)](/Article/PythonBasis/python7/3.md) - [生成器](/Article/PythonBasis/python7/4.md) - [迭代器和生成器综合例子](/Article/PythonBasis/python7/5.md) * [面向对象](/Article/PythonBasis/python8/Preface.md) -- GitLab