学习知多少(python篇):表达式与内置对象
off999 2024-11-18 15:34 23 浏览 0 评论
?
分享兴趣,传播快乐,增长见闻,留下美好!
亲爱的您,这里是LearningYard学苑。今天小编为大家带来“学习知多少(python篇):表达式与内置对象”,欢迎您的访问。
Share interests, spread happiness, increase knowledge, and leave a good legacy!
Dear you, this is The LearningYard Academy. Today Xiaobian brings you "Learn how much to know (python):Expressions and built-in objects”, welcome your visit.
一、关键字
One. Keywords
Python关键字是特殊的保留字,它为编译器/解释器传达了特殊的含义。每个关键字都有特殊含义和特定操作。python关键字只允许用来表达特定的语义,不允许通过任何方式改变他们的含义,也不能作为变量名、函数名或者类名等标识符。
Python keywords are special reserved words that convey a special meaning to the compiler/interpreter. Each keyword has a special meaning and a specific action. Python keywords are only allowed to express specific semantics, and they are not allowed to change their meaning in any way, nor can they be used as identifiers such as variable names, function names, or class names.
1、内置常量
False None True
2、逻辑与运算符
and not or
3、判断与循环
if elif else
for while
break continue
4、函数
def lambda
pass return yied
5、异常处理
try except finally raise assert
6、导入模块包
import from
7、重命名
as
8、变量
global nonlocal
9、类
class
10、删除
del
11、上下文管理
with
1、Built-in constants
False None True
2. Logic and operators
and not or
3. Judgment and circulation
if elif else
for while
break continue
4. Functions
def lambda
pass return yied
5. Exception handling
try except finally raise assert
6. Import the module package
import from
7. Rename
as
8. Variables
global nonlocal
9. Class
class
10. Deletion
del
11. Context management
with
二、内置函数
Two、 Built-in functions
内置函数是python内置对象类型之一,不需要额外导入任何模块即可直接使用,这些内置对象都封装在内置板块__builtins__之中。
Built-in functions are one of Python's built-in object types, which can be used directly without importing any additional modules, and these built-in objects are encapsulated in the built-in plate __builtins__.
1、abs(x)
返回数字x的绝对值或复数的模。
2、ascii(obj)
把对象转换成ASCII码表现形式,必要的时候使用转义字符来表示特定的字符。
3、bin(x)
把整数x转换成二进制串表示形式。
4、chr(x)
返回Unicode编码为x的字符。
5、filter(func,seq)
返回filter对象,其中包含序列seq中是的单参数函数func返回值为True的那些对象。
6、help(obj)
返回对象obj的帮助信息。
7、len(obj)
返回对象obj包含的元素个数,适用于元组、列表、集合、字典、字符串以及range对象,不适用于具有惰性求值特点的生成器对象和map、zip等迭代对象。
8、list([x])、set([x])、tupli([x])、dict([x])
把对象x转换为列表、集合、元组或字典并返回,或生成空列表、空集合、空元组、空字典。
9、map(func,*iterables)
返回包含若干函数值的map对象,函数func的参数分别来自于iterables指定的一个或多个迭代对象。
10、range([start,]end[,step])
返回range对象,其中包含左闭右开区间[start,end]内以step为步长的整数。
1、abs(x)
Returns the absolute value of the number x or the modulus of a complex number.
2、ascii(obj)
Convert objects into ASCII representations, using escape characters to represent specific characters when necessary.
3、bin(x)
Converts the integer x to binary string representation.
4、chr(x)
Returns characters encoded in Unicode as x.
5、filter(func,seq)
Returns a filter object that contains those objects that are returned to true by the single-parameter function func in the sequence seq.
6、help(obj)
Returns help information for the object obj.
7、len(obj)
Returns the number of elements contained in the obj object, which is suitable for tuples, lists, collections, dictionaries, strings, and range objects, and is not applicable to generator objects and iteration objects such as map and zip with lazy evaluation characteristics.
8、list([x])、set([x])、tupli([x])、dict([x])
Converts the object x to a list, collection, tuple, or dictionary and returns, or generates an empty list, empty collection, empty tuple, empty dictionary.
9、map(func,*iterables)
Returns a map object containing several function values, the arguments of the func function from one or more iteration objects specified by iterables.
10、range([start,]end[,step])
Returns a range object containing integers with step in the left and right open interval [start, end].
三、案例
Three. Cases
今天的分享就到这里了。
如果您对今天的文章有独特的想法,
欢迎给我们留言,
让我们相约明天。
祝您今天过得开心快乐!
That's all for today's sharing.
If you have a unique idea for today’s article,
please leave us a message,
and let us meet tomorrow.
I wish you a happy day !
本文由learningyard新学苑原创,如有侵权,请联系我们!
翻译来源于谷歌翻译
部分来源于
百度文库
清华大学出版 董付国《Python程序设计基础》
编辑&排版|百味
审核|闫庆红
相关推荐
- 在NAS实现直链访问_如何访问nas存储数据
-
平常在使用IPTV或者TVBOX时,经常自己会自定义一些源。如何直链的方式引用这些自定义的源呢?本人基于armbian和CasaOS来创作。使用标准的Web服务器(如Nginx或Apache...
- PHP开发者必备的Linux权限核心指南
-
本文旨在帮助PHP开发者彻底理解并解决在Linux服务器上部署应用时遇到的权限问题(如Permissiondenied)。核心在于理解“哪个用户(进程)在访问哪个文件(目录)”。一、核心...
- 【Linux高手必修课】吃透sed命令!文本手术刀让你秒变运维大神!
-
为什么说sed是Linux运维的"核武器"?想象你有10万个配置文件需要批量修改?传统方式要写10万行脚本?sed一个命令就能搞定!这正是运维工程师的"暴力美学"时...
- 「实战」docker-compose 编排 多个docker 组成一个集群并做负载
-
本文目标docker-compose,对springboot应用进行一个集群(2个docker,多个类似,只要在docker-compose.yml再加boot应用的服务即可)发布的过程架构...
- 企业安全访问网关:ZeroNews反向代理
-
“我们需要让外包团队访问测试环境,但不想让他们看到我们的财务系统。”“审计要求我们必须记录所有第三方对内部系统的访问,现在的VPN日志一团糟。”“每次有新员工入职或合作伙伴接入,IT部门都要花半天时间...
- 反向代理以及其使用场景_反向代理实现过程
-
一、反向代理概念反向代理(ReverseProxy)是一种服务器配置,它将客户端的请求转发给内部的另一台或多台服务器处理,然后将响应返回给客户端。与正向代理(ForwardProxy)不同,正向代...
- Nginx反向代理有多牛?一篇文章带你彻底搞懂!
-
你以为Nginx只是个简单的Web服务器?那可就大错特错了!这个看似普通的开源软件,实际上隐藏着惊人的能力。今天我们就来揭开它最强大的功能之一——反向代理的神秘面纱。反向代理到底是什么鬼?想象一下你...
- Nginx反向代理最全详解(原理+应用+案例)
-
Nginx反向代理在大型网站有非常广泛的使用,下面我就重点来详解Nginx反向代理@mikechen文章来源:mikechen.cc正向代理要理解清楚反向代理,首先:你需要搞懂什么是正向代理。正向代理...
- centos 生产环境安装 nginx,包含各种模块http3
-
企业级生产环境Nginx全模块构建的大部分功能,包括HTTP/2、HTTP/3、流媒体、SSL、缓存清理、负载均衡、DAV扩展、替换过滤、静态压缩等。下面我给出一个完整的生产环境安装流程(C...
- Nginx的负载均衡方式有哪些?_nginx负载均衡机制
-
1.轮询(默认)2.加权轮询3.ip_hash4.least_conn5.fair(最小响应时间)--第三方6.url_hash--第三方...
- Nginx百万并发优化:如何提升100倍性能!
-
关注△mikechen△,十余年BAT架构经验倾囊相授!大家好,我是mikechen。Nginx是大型架构的核心,下面我重点详解Nginx百万并发优化@mikechen文章来源:mikechen....
- 在 Red Hat Linux 上搭建高可用 Nginx + Keepalived 负载均衡集群
-
一、前言在现代生产环境中,负载均衡是确保系统高可用性和可扩展性的核心技术。Nginx作为轻量级高性能Web服务器,与Keepalived结合,可轻松实现高可用负载均衡集群(HA+LB...
- 云原生(十五) | Kubernetes 篇之深入了解 Pod
-
深入了解Pod一、什么是PodPod是一组(一个或多个)容器(docker容器)的集合(就像在豌豆荚中);这些容器共享存储、网络、以及怎样运行这些容器的声明。我们一般不直接创建Pod,而是...
- 云原生(十七) | Kubernetes 篇之深入了解 Deployment
-
深入了解Deployment一、什么是Deployment一个Deployment为Pods和ReplicaSets提供声明式的更新能力。你负责描述Deployment中的目标状...
- 深入理解令牌桶算法:实现分布式系统高效限流的秘籍
-
在高并发系统中,“限流”是保障服务稳定的核心手段——当请求量超过系统承载能力时,合理的限流策略能避免服务过载崩溃。令牌桶算法(TokenBucket)作为最经典的限流算法之一,既能控制请求的平...
你 发表评论:
欢迎- 一周热门
- 最近发表
- 标签列表
-
- python计时 (73)
- python安装路径 (56)
- python类型转换 (93)
- python进度条 (67)
- python吧 (67)
- python的for循环 (65)
- python格式化字符串 (61)
- python静态方法 (57)
- python列表切片 (59)
- python面向对象编程 (60)
- python 代码加密 (65)
- python串口编程 (77)
- python封装 (57)
- python写入txt (66)
- python读取文件夹下所有文件 (59)
- python操作mysql数据库 (66)
- python获取列表的长度 (64)
- python接口 (63)
- python调用函数 (57)
- python多态 (60)
- python匿名函数 (59)
- python打印九九乘法表 (65)
- python赋值 (62)
- python异常 (69)
- python元祖 (57)