diff --git a/docs/10.md b/docs/10.md index 2165a83fce83eecb19f0b50b251e5542881b2fc0..959de449bce2b353a93c3d44d571dc259f24c6d4 100644 --- a/docs/10.md +++ b/docs/10.md @@ -69,7 +69,7 @@ print(z) 调用 afunction()之后,将更改整个程序的全局变量。 -## 行使 +## 练习 Local and global variables can be used together in the same program. Try to determine the output of this program: diff --git a/docs/11.md b/docs/11.md index 170c2f78a42ba29a4eca520ccb425f9727c0cad1..d1146e13dd0ee8dd5c1b50ff97b79c85f170b3b8 100644 --- a/docs/11.md +++ b/docs/11.md @@ -1,16 +1,16 @@ -# 范围 +# 作用域 > 原文: [https://pythonspot.com/scope](https://pythonspot.com/scope) -## 范围 +## 作用域 -变量只能到达定义它们的区域,这称为 _ 范围 _。 将其视为可以使用变量的代码区域。 Python 支持全局变量(可在整个程序中使用)和局部变量。 +变量只能到达定义它们的区域,这称为 _ 作用域 _。 将其视为可以使用变量的代码区域。 Python 支持全局变量(可在整个程序中使用)和局部变量。 默认情况下,函数中声明的所有变量都是局部变量。 要访问函数内部的全局变量,必须明确定义“全局变量”。 ## 示例 -下面我们将研究用法 局部变量和范围。 此 _**不起作用**_ : +下面我们将研究用法 局部变量和作用域。 此 _**不起作用**_ : ```py #!/usr/bin/python diff --git a/docs/12.md b/docs/12.md index 14f77976d5cc1515e4eb6981a47f31d742631e94..536cc89320c5e612d1207420927de4168113525d 100644 --- a/docs/12.md +++ b/docs/12.md @@ -1,4 +1,4 @@ -# 循环:For 循环,while 循环 +# 循环:`For`循环,`while`循环 > 原文: [https://pythonspot.com/loops/](https://pythonspot.com/loops/) @@ -6,7 +6,7 @@ Python 有 3 种循环类型:for 循环,while 循环和嵌套循环。 -## 对于循环 +## `for`循环 We can iterate a list using a for loop @@ -33,7 +33,7 @@ for i in range(1,10): ``` -## While 循环 +## `While`循环 If you are unsure how many times a code should be repeated, use a while loop. For example, diff --git a/docs/13.md b/docs/13.md index f11797206696c262303cd3075840a33a158cf530..4bc7ec210c15cefa74c368e4645e3daeee56cca8 100644 --- a/docs/13.md +++ b/docs/13.md @@ -28,7 +28,7 @@ The python range function in the interpreter * Python 3.x: _range()函数生成一个序列。_ -## range in python 2.7 +## python 2.7 中的范围 A call to range(5) will return: 0,1,2,3,4. diff --git a/docs/14.md b/docs/14.md index 57447f42fcdd77c1e829fde97d0d55ff21868f4a..c7eef262a0dd4a893253539f3b90b14951f5cb09 100644 --- a/docs/14.md +++ b/docs/14.md @@ -29,7 +29,7 @@ personInfo = ("Diana", 32, "New York") 元组中的数据可以是一种或多种数据类型,例如文本和数字。 -## 资料存取 +## 数据存取 To access the data we can simply use an index. As usual, an index is a number between brackets: diff --git a/docs/15.md b/docs/15.md index fb7ec33d6cb86f19fa0245e1518f488f7eda3503..77328c156fcfff464ffff137aca3dfe1a953c41d 100644 --- a/docs/15.md +++ b/docs/15.md @@ -6,7 +6,7 @@ 一对大括号创建一个空字典: `{}` 。 每个元素都可以映射到某个值。 整数或字符串可用于索引。 字典没有命令。 -## 字典范例 +## 字典示例 Let us make a simple dictionary: @@ -59,7 +59,7 @@ This sentence is stored here. ``` -## 处理字典 +## 使用字典 We can manipulate the data stored in a dictionairy after declaration.  This is shown in the example below: diff --git a/docs/16.md b/docs/16.md index 570b1cb109aeeb8c3cbe9a513a4a31b12c74534f..2e065da213751d39dab89400facc562558bddee6 100644 --- a/docs/16.md +++ b/docs/16.md @@ -46,7 +46,7 @@ print(c) 在上面的示例中,我们将两个具有数据类型字符串的变量强制转换为数据类型 float。 -## 转换功能 +## 转换函数 To convert between datatypes you can use: diff --git a/docs/17.md b/docs/17.md index 06d5910f3e1414166b94ce72c7700cfa3a0a8f2e..ced306f17e0c46f7b70503cbd048b7de2448bf5c 100644 --- a/docs/17.md +++ b/docs/17.md @@ -49,7 +49,7 @@ print(uniform(1, 10)) 从列表中选择一个随机项目 -## 有趣的列表 +## 打乱列表 我们可以使用以下代码对列表进行随机排列: diff --git a/docs/19.md b/docs/19.md index 1d38c656c65510de57ed9d5ae8a42a50a689fcd1..910ea34bf049b5b07ab9cd3d06be452c310727a8 100644 --- a/docs/19.md +++ b/docs/19.md @@ -1,10 +1,10 @@ -# 读取档案 +# 读取文件 > 原文: [https://pythonspot.com/read-file/](https://pythonspot.com/read-file/) 您之前已经看过各种类型的数据持有者:整数,字符串,列表。 但是到目前为止,我们还没有讨论如何读取或写入文件。 -## 读取档案 +## 读取文件 You can read a file with the code below. diff --git a/docs/20.md b/docs/20.md index cbf20cc57adf5f58a589dcd41904e2ef758cd453..4f682599abf9572963db760795f11ff0c0e64b52 100644 --- a/docs/20.md +++ b/docs/20.md @@ -1,4 +1,4 @@ -# 写文件 +# 写入文件 > 原文: [https://pythonspot.com/write-file/](https://pythonspot.com/write-file/) @@ -51,7 +51,7 @@ myfile.close() ``` -## 参量 +## 参数 A summary of parameters: diff --git a/docs/21.md b/docs/21.md index b7c0f22698d682be825c2e75a22ac8f409e50868..781cd5d6a0f53ded4daafb3ae0017164b12fc7c9 100644 --- a/docs/21.md +++ b/docs/21.md @@ -17,10 +17,6 @@ Technology always evolves. What are classes and where do they come from? 让我们一起潜水吧! -## Python 课程: - -[Python 编程训练营:从零到英雄](https://gum.co/dcsp) - ## Python 类 We can create virtual objects in Python. A virtual object can contain variables and methods.  A program may have many different types and are created from a class. Example: diff --git a/docs/23.md b/docs/23.md index f07bb3344825183c4a4f38d5c20fa199eb8133d2..37c2ccc56cdaa6310e0fe9637aa1a70fb4e26414 100644 --- a/docs/23.md +++ b/docs/23.md @@ -1,10 +1,10 @@ -# 封装形式 +# 封装 > 原文: [https://pythonspot.com/encapsulation](https://pythonspot.com/encapsulation) 在面向对象的 python 程序中,您可以 _ 限制对方法和变量的访问 _。 这可以防止意外修改数据,这就是 _ 封装 _。 让我们从一个例子开始。 -## 私人方法 +## 私有方法 ![encapsulation](img/f9a64d9604d279e122057d7ac9086909.jpg) @@ -48,7 +48,7 @@ driving 实际上可以使用 redcar._Car__updateSoftware()调用该方法。 -## 私人变量 +## 私有变量 ![encapsulation-example](img/5c9510eede5c19eda3992c95d2bcb565.jpg) @@ -123,6 +123,6 @@ Other programming languages have protected class methods too, but Python does no | 类型 | 描述 | | --- | --- | | 公开方法 | 可从任何地方访问 | -| 私人方法 | 仅在自己的课程中可访问。 以两个下划线开头 | +| 私有方法 | 仅在自己的课程中可访问。 以两个下划线开头 | | 公共变量 | 可从任何地方访问 | -| 私人变量 | 仅在自己的类或方法(如果已定义)中可访问。 以两个下划线开头 | \ No newline at end of file +| 私有变量 | 仅在自己的类或方法(如果已定义)中可访问。 以两个下划线开头 | \ No newline at end of file diff --git a/docs/25.md b/docs/25.md index 80dbfdacf5ce100f4a53ff3ee63a9e5ddceb303c..cd99cf340bf8e30372719a849052459017315600 100644 --- a/docs/25.md +++ b/docs/25.md @@ -1,4 +1,4 @@ -# 遗产 +# 继承 > 原文: [https://pythonspot.com/inheritance/](https://pythonspot.com/inheritance/) @@ -6,7 +6,7 @@ 与其他流行的编程语言不同,Python 支持从多个类继承。 -## 归纳法 +## 介绍 We define a basic class named User: diff --git a/docs/26.md b/docs/26.md index ea7455287fafc8102ba536ee43209708cb310af3..bf6788fee70fc5e245764ae6789d1b27cb8f2ccb 100644 --- a/docs/26.md +++ b/docs/26.md @@ -1,12 +1,12 @@ -# 多态性 +# 多态 > 原文: [https://pythonspot.com/polymorphism/](https://pythonspot.com/polymorphism/) -有时,对象有多种类型或形式。 如果我们有一个按钮,则有许多不同的绘制输出(圆形按钮,复选按钮,方形按钮,带有图像的按钮),但它们确实共享相同的逻辑:onClick()。 我们使用相同的方法访问它们。 这个想法称为 _ 多态性 _。 +有时,对象有多种类型或形式。 如果我们有一个按钮,则有许多不同的绘制输出(圆形按钮,复选按钮,方形按钮,带有图像的按钮),但它们确实共享相同的逻辑:onClick()。 我们使用相同的方法访问它们。 这个想法称为 _ 多态 _。 多态是基于希腊语 Poly(许多)和 morphism(形式)。 我们将创建一个可以采用或使用多种形式的对象的结构。 -## 具有功能的多态性: +## 具有函数的多态: We create two classes:  Bear and Dog, both  can make a distinct sound.  We then make two instances and call their action using the same method. @@ -93,7 +93,7 @@ Document3: Show word contents! 我们有一个抽象访问点(文档),用于访问遵循相同结构的多种类型的对象(pdf,word)。 -## 多态性示例 +## 多态示例 ![polymorphism-example](img/744304fa9c5a5b805fd3179eb9881d70.jpg) diff --git a/docs/27.md b/docs/27.md index cfcb39b149983a07db69c6fd6a786678609377ed..e83633045a4ed4cd4788845aa480c0338b5b53cf 100644 --- a/docs/27.md +++ b/docs/27.md @@ -1,4 +1,4 @@ -# 内部班 +# 内部类 > 原文: [https://pythonspot.com/inner-classes](https://pythonspot.com/inner-classes) diff --git a/docs/28.md b/docs/28.md index b47d1e5aeba39944bf1abcced2d88dd229f5b34d..a9c4516e6a3d9800b7b7eee8605ce42a1bb814fa 100644 --- a/docs/28.md +++ b/docs/28.md @@ -13,10 +13,6 @@ * 如果用户启动 Web 浏览器,则浏览器不会事先知道将打开多少个选项卡(每个选项卡都是一个对象)。 -## Related Course: - -[Python Programming Bootcamp: Go from zero to hero](https://gum.co/dcsp) - ## 工厂方法模式 To deal with this we can use the _factory method_ pattern. diff --git a/docs/30.md b/docs/30.md index 632cd693a17f90f25737246b9d54e4297b8c7951..aed610515e5ee476275547f5c0eb02904057ece0 100644 --- a/docs/30.md +++ b/docs/30.md @@ -1,4 +1,4 @@ -# 记录中 +# 日志 > 原文: [https://pythonspot.com/logging/](https://pythonspot.com/logging/) @@ -8,7 +8,7 @@ We can track events in a software application, this is known as **logging**. Let 与仅打印错误相反,可以将日志记录配置为禁用输出或保存到文件。 这是简单打印错误的一大优势。 -## 记录示例 +## 日志示例 ```py import logging @@ -59,8 +59,6 @@ logging.basicConfig(level=logging.DEBUG) | 错误 | 该软件将不再能够运行 | | 危急 | 非常严重的错误 | -| - ```py import logging @@ -69,8 +67,6 @@ logging.debug('Debug message') ``` - | - ## 记录时间 You can enable time for logging using this line of code: diff --git a/docs/31.md b/docs/31.md index b1750b880acee5aeb8fd2f5a28b76be1731c0279..0b642e3dab2681ba76b054865333f7b9f15045fe 100644 --- a/docs/31.md +++ b/docs/31.md @@ -1,10 +1,10 @@ -# Python 子进程 +# Python `subprocess` > 原文: [https://pythonspot.com/python-subprocess/](https://pythonspot.com/python-subprocess/) -子流程模块使您可以从 Python 程序启动新应用程序。 多么酷啊? +`subprocess`模块使您可以从 Python 程序启动新应用程序。 多么酷啊? -## 在 Python 中启动一个过程: +## 在 Python 中启动一个进程: You can start a process in Python using the Popen function call. The program below starts the unix program ‘cat’ and the second parameter is the argument. This is equivalent to ‘cat test.py’.  You can start any program with any parameter. @@ -19,9 +19,9 @@ print stdout ``` -process.communicate()调用从过程中读取输入和输出。 stdout 是进程输出。 仅当发生错误时,stderr 才会被写入。 如果要等待程序完成,可以调用 Popen.wait()。 +process.communicate()调用从进程中读取输入和输出。 stdout 是进程输出。 仅当发生错误时,stderr 才会被写入。 如果要等待程序完成,可以调用 Popen.wait()。 -## 子流程 call(): +## `subprocess.call()`: Subprocess has a method call() which can be used to start a program. The parameter is a list of which the first argument must be the program name. The full definition is: diff --git a/docs/32.md b/docs/32.md index 4b55fc6f50c30d1e5e670a39fae0f1fda87a3d64..786acdddc033963c8122826c085b861fc1a94ca3 100644 --- a/docs/32.md +++ b/docs/32.md @@ -1,8 +1,8 @@ -# 线程和线程 +# `threading`和`_thread` > 原文: [https://pythonspot.com/threading](https://pythonspot.com/threading) -在 Python 中,您可以使用 Python 2.x 中的线程模块或 Python 3 中的 _thread 模块创建线程。我们将使用线程模块与之交互。 +在 Python 中,您可以使用 Python 2.x 中的`threading`模块或 Python 3 中的 _thread 模块创建线程。我们将使用`threading`模块与之交互。 线程是一种操作系统进程,具有与正常进程不同的功能: * 线程作为进程的子集存在 @@ -46,7 +46,7 @@ for x in xrange(10): 如果运行一次,线程不必停止。 线程可以是定时的,每 x 秒重复执行一次线程功能。 -## 定时线程 +## 线程定时 In Python, the Timer class is a subclass of the Thread class. This means it behaves similar. We can use the timer class to create timed threads. Timers are started with the .start() method call, just like regular threads. The program below creates a thread that starts after 5 seconds. diff --git a/docs/33.md b/docs/33.md index 1223a69a20db6f1a7e8c2e5df254a034359d4ee5..a4f2f3daa3458ddb27f677d22e9fe8bf46895a4a 100644 --- a/docs/33.md +++ b/docs/33.md @@ -4,11 +4,6 @@ 我们可以创建匿名函数,称为 lambda 函数。 Lambda 函数与常规 Python 函数不同,它们源自 Lambda 微积分。 它允许您编写非常简短的函数。 -## Related Courses: - - -* [Python 编程训练营:从零变成英雄](https://gum.co/dcsp) - ## Lambda 函数示例 此代码显示 lambda 函数的用法: @@ -33,7 +28,7 @@ print(f(12)) ``` -## 地图功能 +## `map`函数 The definition of map is map(function,iterable). It applies a function to every item in the iteratable. We can use map() to on a lambda function with a list: @@ -48,7 +43,7 @@ print(squaredList) 在使用 lambda 函数的任何地方,都可以改用普通函数。 Lambda 函数不是语句,而是表达式。 Lambda 函数不支持语句块。 -## 过滤功能 +## `filter`函数 filter(function,iterable) creates a new list from the elmeents for which the function returns True. Example: @@ -63,7 +58,7 @@ print(newList) 返回列表只包含 lambda 表达式“ lamba x:x%2 == 0”为真的元素。 -## 减少功能 +## `reduce`函数 The reduce function, reduce(function, iterable) applies two arguments cumulatively to the items of iterable, from left to right. Example: diff --git a/docs/34.md b/docs/34.md index 9c6e5db0b6bb081d78d6fc05e7eb2389024eb75f..4713d447405f4a32701901edacd9d0463ef1fb29 100644 --- a/docs/34.md +++ b/docs/34.md @@ -1,12 +1,12 @@ -# Python 集 +# Python 集合 > 原文: [https://pythonspot.com/python-set/](https://pythonspot.com/python-set/) -## 用 Python 设置 +## Python 集合 A set in Python is a collection of objects. Sets are available in Python 2.4 and newer versions. They are different from lists or tuples in that they are modeled after sets in mathematics. -## 设置示例 +## 集合示例 要创建一个集合,我们使用 set()函数。 @@ -43,9 +43,9 @@ print(y) ``` -## 设定方法 +## 集合方法 -## Clear elements from set +## 从集合清除元素 To remove all elements from sets: @@ -71,9 +71,9 @@ print(x) ``` -## 将元素删除到集合中 +## 将元素从集合中删除 -要将元素删除到集合中: +要将元素从集合中删除: ```py !/usr/bin/env python @@ -84,9 +84,9 @@ print(x) ``` -## 两组之间的差异 +## 两个集合之间的差异 -要查找两组之间的差异,请使用: +要查找两个集合之间的差异,请使用: ```py #!/usr/bin/env python @@ -113,9 +113,9 @@ print( x.issubset(y) ) ``` -## 超级集 +## 超集 -要测试集合是否是超级集,请执行以下操作: +要测试集合是否是超集,请执行以下操作: ```py #!/usr/bin/env python @@ -126,9 +126,9 @@ print( x.issuperset(y) ) ``` -## 交叉点 +## 交集 -要测试交叉点,请使用: +要测试交集,请使用: ```py #!/usr/bin/env python diff --git a/docs/38.md b/docs/38.md index d48e0347f4ddef9e4c6436e7ec49809bd7f43dbb..3ed558b69ad862f51d34569f4481864df7e0892b 100644 --- a/docs/38.md +++ b/docs/38.md @@ -10,11 +10,6 @@ A tree with eight nodes. The root of the tree (5) is on top. Python 没有对树的内置支持。 -## Related Course: - - -* [Python 编程训练营:从零变成英雄](https://gum.co/dcsp) - ## 二叉树 **A binary** **tree** is a data structure where every node has at most two children (left and right child). The **root** of a tree is on top. Every node below has a node above known as the parent node.We define a class thee which has a left and right attribute. From this binary tree we define the root (top of the three) and a left and right node. diff --git a/docs/39.md b/docs/39.md index 194a493186e9592b6bad430b39256c5cda00ce01..ac6bc0e2c5431c8428cd4c209637bdef0447bf67 100644 --- a/docs/39.md +++ b/docs/39.md @@ -18,7 +18,7 @@ This tiny amount of information, the smallest amount of information that you can To represent higher numbers than 1, the idea was born to use a sequence of bits. A sequence of eight bits could store much larger numbers, this is called a _byte_. A sequence consisting of ones and zeroes is known as _binary_. Our traditional counting system with ten digits is known as decimal. - 原文: [https://pythonspot.com/read-file/](https://pythonspot.com/read-file/) 您之前已经看过各种类型的数据持有者:整数,字符串,列表。 但是到目前为止,我们还没有讨论如何读取或写入文件。 -## 读取档案 +## 读取文件 You can read a file with the code below. diff --git a/docs/42.md b/docs/42.md index cbf20cc57adf5f58a589dcd41904e2ef758cd453..8c3f8fa72705b4efefb316eab091bb4ea71c2b79 100644 --- a/docs/42.md +++ b/docs/42.md @@ -51,7 +51,7 @@ myfile.close() ``` -## 参量 +## 参数 A summary of parameters: diff --git a/docs/49.md b/docs/49.md index 735bf22df03cb666a17d2f5fcf2628f20f7b72db..d0ae448bed3fe81383327d8d87d22a93241b5371 100644 --- a/docs/49.md +++ b/docs/49.md @@ -10,7 +10,7 @@ * [flaskr](http://flask.pocoo.org/docs/0.10/tutorial/introduction/) -微博 * [minitwit](https://github.com/mitsuhiko/flask/tree/master/examples/minitwit/) -一个推特克隆 -* [flask 网站](https://github.com/mitsuhiko/flask-website)-静态页面+邮件列表档案 +* [flask 网站](https://github.com/mitsuhiko/flask-website)-静态页面+邮件列表文件 ## 安装烧瓶 diff --git a/docs/5.md b/docs/5.md index a1e84193025a1ea0647245fe1d9b44e0d42acf5f..f40bb75209f42ae5864fe7d4f58a392628ad14d2 100644 --- a/docs/5.md +++ b/docs/5.md @@ -1,4 +1,4 @@ -# 弦片(第 2 部分) +# 字符串(第 2 部分) > 原文: [https://pythonspot.com/string-slices-part-2/](https://pythonspot.com/string-slices-part-2/) diff --git a/docs/50.md b/docs/50.md index 0ca3e04fe5d6afe16d6b249c40400d0ac41e8f67..680e35ae6e8098796b226c60a5806d69e7cdfcd1 100644 --- a/docs/50.md +++ b/docs/50.md @@ -11,7 +11,7 @@ Jinja2 模板只是一个文本文件,不需要特定的扩展名,例如.htm | 定界符 | 用法 | | --- | --- | -| <raw><…%><endraw></endraw></raw> | 陈述 | +| <raw><…%><endraw></endraw></raw> | 语句 | | <raw><…> ><endraw></endraw></raw> | 要打印到模板输出的表达式 | | <raw><…#><endraw></endraw></raw> | 注释未包含在模板输出中 | | <raw>#…##<endraw></endraw></raw> | 行语句 | diff --git a/docs/6.md b/docs/6.md index 245e86dde1b35e465c9105509dc46cd23bcc47d7..4904f7da5a9f3d6ac5a4f88d62be2d67cd0de731 100644 --- a/docs/6.md +++ b/docs/6.md @@ -18,10 +18,6 @@ * 布尔值 _(对或错)_ -## Related Course: - -[Python Programming Bootcamp: Go from zero to hero](https://gum.co/dcsp) - ## 数值变量示例 Example of numeric variables: diff --git a/docs/60.md b/docs/60.md index 84739c1279e7136bba1f0d70d10690b2526b8785..13a0b39b4cede6753afafd759793206f3b1f4c8b 100644 --- a/docs/60.md +++ b/docs/60.md @@ -115,7 +115,7 @@ print json.dumps(d, ensure_ascii=False) | JSON 格式 | 蟒蛇 | | --- | --- | | 宾语 | 字典 | -| 数组 | 清单 | +| 数组 | 列表 | | 串 | 力量 | | 数字(整数) | 整型 | | 数字(实数) | 浮动 | diff --git a/docs/7.md b/docs/7.md index 0e91ed7cfb52cce8df20692e6f3e54e2c29edb30..640ccc9eec22c258ab18c330873ec5442a0a778c 100644 --- a/docs/7.md +++ b/docs/7.md @@ -1,10 +1,10 @@ -# Python 清单 +# Python 列表 > 原文: [https://pythonspot.com/python-lists/](https://pythonspot.com/python-lists/) 列表是一个序列和一个基本的数据结构。 列表可以包含字符串(文本)和数字。 列表类似于其他编程语言中的数组,但具有其他功能。 -## Python 清单 +## Python 列表 We define lists with brackets []. To access the data, these same brackets are used. Example list usage: @@ -38,7 +38,7 @@ print(l) # print all elements. ``` -## 排序清单 +## 排序列表 We can sort the list using the sort() function. diff --git a/docs/8.md b/docs/8.md index 37e7f37e86b2d39d1893e2d5e26c6c93795774c8..4b6b46c465bf101d5171b01a7d2dbb3546260732 100644 --- a/docs/8.md +++ b/docs/8.md @@ -1,11 +1,11 @@ -# 如果陈述 +# `if`语句 > 原文: [https://pythonspot.com/if-statements/](https://pythonspot.com/if-statements/) 在 Python 中,您可以定义条件语句,称为 if 语句。 如果满足某些条件,则将执行代码块。 -## 如果陈述 +## `if`语句 Consider this application, it executes either the first or second code depending on the value of x. @@ -46,7 +46,7 @@ A word on conditional operators Do not confuse the assignment operator (=) with the equals operator (==). -## 套料 +## 嵌套 The most straightforward way to do multiple conditions is nesting: diff --git a/docs/89.md b/docs/89.md index c6095cf777215e1278f7afb5492818e8507d9f4e..3a49c2a573ed915c8b3ffb6f935c75442a0e229f 100644 --- a/docs/89.md +++ b/docs/89.md @@ -17,7 +17,7 @@ re.match(pattern, string) 参数为: -| 参量 | 描述 | +| 参数 | 描述 | | --- | --- | | 图案 | 正则表达式 | | 串 | 输入字符串 | diff --git a/docs/9.md b/docs/9.md index 71e2212c716a64dc4e73173405d1a005e2a7f036..b3d128f311ebcd0b92367850daa9e4bc6302f744 100644 --- a/docs/9.md +++ b/docs/9.md @@ -1,12 +1,12 @@ -# 职能 +# 函数 > 原文: [https://pythonspot.com/functions/](https://pythonspot.com/functions/) 函数是可重用的代码,可以在程序中的任何位置调用。 函数提高了代码的可读性:使用函数而不是冗长的指令列表,使人们更容易理解代码。 -最重要的是,可以重复使用或修改功能,这也提高了可测试性和可扩展性。 +最重要的是,可以重复使用或修改函数,这也提高了可测试性和可扩展性。 -## 功能定义 +## 函数定义 We use this syntax to define as function: @@ -17,7 +17,7 @@ def function(parameters): ``` -**def 关键字**告诉 Python 我们有一段可重用的代码(一个函数)。 一个程序可以具有许多功能。 +**def 关键字**告诉 Python 我们有一段可重用的代码(一个函数)。 一个程序可以具有许多函数。 ## 实际例子 @@ -42,7 +42,7 @@ print(f(3)) 该函数具有一个参数 x。 返回值是函数返回的值。 并非所有函数都必须返回某些内容。 -## 参量 +## 参数  We can pass multiple variables: diff --git a/docs/93.md b/docs/93.md index 2527891b6a7de47944f70f9b12ca6326f33c03fe..02f40259c319fbb89d86c35439573bd721c6eb94 100644 --- a/docs/93.md +++ b/docs/93.md @@ -28,7 +28,7 @@ python -m http.server ## 有趣的文字 -尝试以下陈述来显示蒂姆·彼得斯的诗。 +尝试以下语句来显示蒂姆·彼得斯的诗。 ```py import this