Python编程术语词汇表(一)
yund56 2025-05-15 23:27 10 浏览
这是一个非官方的 Python 编程术语表,是日常编程实践以及网络收藏所得的内容集合。
Iteration 迭代
Looping over an iterable object.
遍历可迭代对象。
A for loop is the epitome of iteration, but there are many other ways to iterate over an iterable in Python.
一个 for 循环是迭代的典范,但在 Python 中还有许多其他方法可以遍历可迭代对象。
Iterable 可迭代
(Our perspective as Python users) Anything you can loop over with a for loop or by various other forms of iteration. More on iterables in What is an iterable.
(作为 Python 用户的我们) 你可以用 for 循环或通过其他各种迭代形式遍历的任何内容。关于可迭代对象的更多信息,请参阅什么是可迭代对象。
(Python's perspective) Anything that can be passed to the built-in iter function to get an iterator from it. If you're inventing your own iterable class, also see How to make an iterable.
(Python 视角)任何可以被传递给内置的 iter 函数以从中获取迭代器的对象。如果你正在创建自己的可迭代类,也请参阅如何创建可迭代对象。
String 字符串
Strings are a data type used for storing text. Strings are made up of characters, which may be letters, numbers, symbols, whitespace, emoji, etc.
字符串是用于存储文本的数据类型。字符串由字符组成,可以是字母、数字、符号、空白、表情符号等。
Substring 子字符串
A "substring" is a string that is contained within another string.
一个“子字符串”是包含在另一个字符串中的字符串。
As an example, "tho" is a substring of "Python".
例如, "tho" 是 "Python" 的子串。
Boolean 布尔
Python's two Boolean values are True and False. These values both have the type of bool, which stands for Boolean (named after George Boole, in case you're curious).
Python 的两个布尔值是 True 和 False 。这两个值都具有 bool 类型,代表布尔(如果你好奇,这个名字是为了纪念乔治·布尔)。
Integer (a.k.a. int) 整数(又称 int )
Integers are used for representing whole numbers in Python. The numbers 5, 0, and -2 are examples of integers.
整数用于在 Python 中表示整数。数字 5 、0 和 -2 是整数的例子。
Floating Point Numbers (a.k.a. float)
浮点数(又称 float )
Floating point numbers are used for representing non-integers. The numbers 5.0, 2.5, and -3.4 are examples of floating point numbers.
浮点数用于表示非整数。数字 5.0 、 2.5 和 -3.4 是浮点数的示例。
Floating point numbers may be equivalent to integers. For example, 5.0 is equal to 5 in Python: 5.0 == 5 returns True.
浮点数可能与整数等价。例如,在 Python 中 5.0 等于 5 : 5.0 == 5 返回 True 。
Index 索引
An integer that represents the position of an item within a list or another sequence.
一个表示列表或另一个序列中项目位置的整数。
Sequences in Python use zero-based indexes, so the first item is at position 0.
Python 中的序列使用零基索引,因此第一个元素位于位置 0 。
Sequence (a.k.a. "list-like object")
序列(又称“类似列表的对象”)
An ordered collection of objects. Sequences have a length (via the built-in len function), can be indexed (starting at 0), and are iterable.
一个有序的对象集合。序列具有长度(通过内置的 len 函数),可以索引(从 0 开始),并且是可迭代的。
Mapping 映射
A dictionary-like object. An object which stores key-value pairs and supports key lookups using square brackets ([...]), among other features we expect dictionary-like objects to support (such as being an iterable). Like sequences, mappings are iterable.
一个类似字典的对象。一个存储键值对并支持使用方括号( [ ... ] )进行键查找的对象,以及其他我们期望类似字典对象支持的功能(如可迭代)。像序列一样,映射是可迭代的。
Tuple 元组
An immutable sequence. Tuples act like a list, but they can't be mutated. While tuples could just be thought of as immutable lists, we usually use the two quite differently: tuples are for storing a fixed number of values, often of different types.
一个不可变序列。元组的行为类似于列表,但不能被修改。虽然元组可以简单地被视为不可变列表,但我们通常使用它们的方式相当不同:元组用于存储固定数量的值,通常是不同类型的值。
List Comprehension 列表推导
A special syntax for building a new list/set/dictionary out of an old iterable. Comprehensions build a new iterable out of an old one while either filtering items down based on a condition or modifying each item based on a mapping expression.
特殊语法,用于从旧的可迭代对象中构建新的列表/集合/字典。列表推导从旧的可迭代对象中构建新的可迭代对象,同时根据条件过滤项目或根据映射表达式修改每个项目。
Truthiness 真实性
Truthiness asks the question "if we convert this object to a Boolean, will we get True or False?"
真实性询问问题:“如果我们将此对象转换为布尔值,我们会得到 True 还是 False ?”
Containment 隔离
Python's in operator checks for "containment": x in y means y "contains" x. All iterables support containment by default, but some objects customize containment checks to make them faster (dictionary containment) or to operate slightly differently (substring checks).
Python 的 in 运算符检查“包含”: x in y 表示 y “包含” x 。所有可迭代对象默认支持包含,但某些对象自定义包含检查以使其更快(字典包含)或略有不同(子字符串检查)。
Lexicographical ordering 词典顺序
Strings, tuples, and lists in Python are ordered "lexicographically".
Python 中的字符串、元组和列表是按“字典序”排序的。
Lexicographical ordering essentially means "similar to alphabetical ordering". For example, "animal" < "apple" is True because since the first letters are equivalent, the second letters are compared and "n" < "p" (in both Unicode and the alphabet). Likewise, (1969, 5, 18) < (1969, 7, 16) is True because since the first indexes are equivalent, the second indexes are compared and 5 < 7.
词序排列本质上意味着“类似于字母顺序”。例如, "animal" < "apple" 等于 True ,因为第一个字母相同,所以比较第二个字母(在 Unicode 和字母表中)。同样, (1969, 5, 18) < (1969, 7, 16) 等于 True ,因为第一个索引相同,所以比较第二个索引和 5 < 7 。
File-like Object 文件对象
A file-like object is an object that behaves like a file.
文件类对象是一种表现得像文件的对象。
Files are file-like objects, but so are the standard input (sys.stdin), standard output (sys.stdout), and standard error (sys.stderr) file streams. It's also possible to create your own file-like objects.
文件是类似文件的对象,但标准输入( sys.stdin )、标准输出( sys.stdout )和标准错误( sys.stderr )文件流也是如此。也可以创建自己的类似文件的对象。
如果你觉得这篇文章对你有帮助,欢迎点赞、收藏和转发!关注我,获取更多 Python 编程技巧和实用知识
相关推荐
- 如何在Office 中编辑 PDF?附详细化步骤
-
PDF很受欢迎,因为它能在不同的设备和操作系统上仍然保持原有格式。但是,这也意味着直接更改PDF文件比其他格式更难更复杂。值得庆幸的是,Microsoftoffice和UPDF帮你解决这一难题。一...
- 我的 Windows 装机必备软件清单
-
今天给大家分享下我的装机必备软件,都是用了好多年的软件神器。靠谱、好用、无广告,Windows电脑必备软件,收藏这一篇就够了!01.浏览器王者:Chromehttps://www.google.c...
- Docnet Core 是一个轻量级、高性能的 .NET PDF 操作库
-
DocnetCore介绍DocnetCore是一个轻量级、高性能的.NETPDF操作库,依托于PDFium渲染引擎,提供强大的PDF文档解析、渲染、操作等功能。它完全支持.NET...
- 分享三款好用的PDF编辑软件,轻松处理PDF
-
作为一名需要经常和PDF文件打交道的工作者,我来分享一下几款好用的PDF编辑软件,并详细分析了它们的优缺点,希望能帮你找到合适的工具。1.AdobeAcrobatDC作为PDF格式的发明者,Ado...
- PDF文档创建工具软件:novaPDF OEM 11.9 Build 432 for Windows
-
novaPDFOEM是一款实用高效的软件,从头开始设计,让您尽可能轻松地在应用程序中添加PDF打印功能。换句话说,这个实用程序是专门为应用程序开发人员设计的,可以直接在程序安装程序中集成为PDF打印...
- 线性表顺序存储结构求集合的并,交,补,差(源代码附上 超详细)
-
一:算法分析1)用数组A,B,C,E表示集合。假定A={1,3,4,5,6,7,9,10}, B={2,,3,4,7,8,10},E={1,2,3,4,5,6,7,8,9,10}, 输入数组A...
- 分享一套SpringBoot开发博客系统源码,包含完整开发文档和视频
-
基本信息项目名称:eblog摘要:eblog是一个基于Springboot2.1.2开发的博客学习项目,为了让项目融合更多的知识点,达到学习目的,编写了详细的从0到1开发文档。主要学习包括:自定义Fr...
- 通达信指标合集〔源码齐全〕
-
很多朋友问到我哪款指标好用,这里我说一下,之所以有很多不同的指标是因为我们在针对不同的盘面情况的时候使用的指标是不同的,我给到的指标一般来讲就目前的环境来讲都是比较适合的,今天我就把我平时自己常用的指...
- 巅峰对决!Spring Boot VS .NET 6
-
SpringBoot和ASP.NETCore都是企业中流行的Web框架,对于喜欢C#的人会使用ASP.NETCore,而对于Java或Kotlin等基于JVM的语...
- 在asp.net core 中控制访问权限的方法
-
Intro#由于项目需要,需要在基于asp.netmvc的Web项目框架中做权限的控制,于是才有了这个权限控制组件,最初只是支持netframework,后来dotnetcore2.0...
- ASP.NET是否无生存之地?
-
ASP.NET,这个已经很久的技术,总觉得已经被时代淘汰,我们公司是一个10人小公司,几个十年十五年的项目还是用ASP.NET开发的。这两年由于客户的需求变化,我们公司也顺势开始对这些项目重新开发,改...
- Spring Boot + Vue.js 实现前后端分离(附源码)
-
作者:梁小生0101链接:juejin.im/post/5c622fb5e51d457f9f2c2381SpringBoot+Vue.js前后端涉及基本概念介绍,搭建记录,本文会列举出用到环...
- ASP.NET Core 中的 Mapster 使用入门教程
-
在本文中,我们将学习如何在ASP.NETCore应用程序中使用Mapster。首先,我们将了解Mapster是什么以及如何将其安装到.NETCore应用程序中。然后,我们将在使用...
- Asp.net常用方法及request和response-a
-
asp.net教程asp.net常用方法:1、Request.UrlReferrer请求的来源,可以根据这个判断从百度搜的哪个关键词、防下载盗链、防图片盗链,可以伪造(比如迅雷)。(使用全局一般处理...
- ASP.NET Core使用功能开关控制路由访问
-
前言在前面的文章,我们介绍了使用Middleware有条件地允许访问路由(《ASP.NETCore使用Middleware有条件地允许访问路由》)。而对于一些试验性的功能,我们并不希望用密码去控制是...
- 一周热门
- 最近发表
- 标签列表
-
- filter函数js (37)
- filter函数excel用不了 (73)
- 商城开发 (40)
- 影视网站免费源码最新版 (57)
- 影视资源api接口 (46)
- 网站留言板代码大全 (56)
- java版软件下载 (52)
- java教材电子课本下载 (48)
- 0基础编程从什么开始学 (50)
- java是用来干嘛的 (51)
- it入门应该学什么 (55)
- java线上课程 (55)
- 学java的软件叫什么软件 (38)
- 程序开发软件有哪些 (53)
- 软件培训 (59)
- 机器人编程代码大全 (50)
- 少儿编程教程免费 (45)
- 新代系统编程教学 (61)
- 共创世界编程网站 (38)
- 亲测源码 (36)
- 三角函数积分公式表 (35)
- 函数的表示方法 (34)
- 表格乘法的公式怎么设置 (34)
- sumif函数的例子 (34)
- 图片素材 (36)