Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
Python语言及其应用(第2版)
by
Bill Lubanovic
March 2022
Intermediate to advanced
522 pages
13h 52m
Chinese
Posts & Telecom Press
Content preview from
Python语言及其应用(第2版)
30
|
第
3
章
分隔的输入
参数
,返回
0
个或多个值即可。
bool()
函数可以接受任何值作为参数并返回等
价的布尔值。
非零的数被视为
True
:
>>> bool(True)
True
>>> bool(1)
True
>>> bool(45)
True
>>> bool(-45)
True
值为
0
的数被视为
False
:
>>> bool(False)
False
>>> bool(0)
False
>>> bool(0.0)
False
第
4
章会介绍布尔值的用途。在后续章节中,你会看到如何将列表、字典和其他类型评估
为
True
或
False
。
3.2
整数
整数就是既没有分数也没有小数点的数字。好吧,除了可能的前缀符号。另外还有基数,
如果你想用惯常的十进制(基数为
10
)之外的方式表示。
3.2.1
字面整数
在
Python
中,
字面整数
就是任意的数位序列:
>>> 5
5
单独的
0
同样有效:
>>> 0
0
但是数位
1
和
9
之间不能有
0
。
>>> 05
File "<stdin>", line 1
05
^
SyntaxError: invalid token
数字
|
31
这个
Python
异常
警告你输入的内容违反了
Python
的规则。
3.2.5
节会解释这
意味着什么。你将在本书中看到更多的异常例子,因为这是
Python
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
Python编程入门与实战
Posts & Telecom Press, Fabrizio Romano
Python实用技能学习指南
Posts & Telecom Press, Robert Smallshire, Austin Bingham
Python技术基础视频教程
保罗·J·戴特尔
Python面向对象编程指南
Posts & Telecom Press, Steven F. Lott
Publisher Resources
ISBN: 9787115586223