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
Luciano Ramalho
April 2023
Intermediate to advanced
769 pages
25h 16m
Chinese
Posts & Telecom Press
Content preview from
流畅的Python(第2版)
84
|
第
3
章
表
3-4
:集合的其他方法
set
frozenset
s.add(e)
●
把元素
e
添加到
s
中
s.clear()
●
删除
s
中的全部元素
s.copy()
●
●
浅拷贝
s
s.discard(e)
●
从
s
中删除元素
e
(如果存在
e
)
s.__iter__()
●
●
获取遍历
s
的迭代器
s.__len__()
●
●
len(s)
s.pop()
●
从
s
中删除并返回一个元素,如果
s
为空,则抛出
KeyError
s.remove(e)
●
从
s
中删除元素
e
,如果
e
不在
s
中,则抛出
KeyError
对集合功能的概述到此结束。
3.12
节将兑现
3.8
节的承诺,探讨与
frozenset
行为非常相
似的两种字典视图。
3.12
字典视图的集合运算
.keys()
和
.items()
这两个
dict
方法返回的视图对象与
frozenset
极为相似,如表
3-5
所示。
表
3-5
:
frozenset
、
dict_keys
和
dict_items
实现的方法
frozenset
dict_keys
dict_items
说明
s.__and__(z)
●
●
●
s & z
(
s
和
z
的交集)
s.__rand__(z)
●
●
●
反向
&
运算符
s.__contains__()
●
●
●
e in s
s.copy()
●
浅拷贝
s
s.difference(it, ...)
●
s
和可迭代对象
it
等的差集
s.intersection(it, ...)
●
s
和可迭代对象
it
等的交集
s.isdisjoint(z)
●
●
●
s
和
z
不相交(没有共同元素) ...
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高级编程(第2版)
Posts & Telecom Press, Michał Jaworski, Tarek Ziadé
Python语言及其应用(第2版)
Bill Lubanovic
Kafka权威指南(第2版)
Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty
Python贝叶斯分析(第2版)
Posts & Telecom Press, Osvaldo Martin
Publisher Resources
ISBN: 9787115612366