Skip to Content
Python语言及其应用(第2版)
book

Python语言及其应用(第2版)

by Bill Lubanovic
March 2022
Intermediate to advanced
522 pages
13h 52m
Chinese
Posts & Telecom Press
Content preview from Python语言及其应用(第2版)
成为
Python
主义者
351
如果想在实际安装之前先“把玩”一番,那么可以在你的
Web
浏览器中试用。
要想在本地安装
Jupyter
Notebook
,输入
pip install jupyter
即可,然后使用
jupyter
notebook
运行。
19.4.5 JupyterLab
JupyterLab
是下一代
Jupyter Notebook
,最终会将其取代。和
Notebook
一样,可以先在浏
览器中试用
JupyterLab
。输入
pip install jupyterlab
在本地安装,然后使用
jupyter lab
运行。
19.5
名称和文档
你是否总是记不住自己写过的东西?有时候,甚至是最近才写的代码,我都记不清它们到
底是从哪儿来的。这就是代码文档的重要性。文档可以包括注释和文档字符串,以及能够
传递信息的变量、函数、模块和类命名。不过你也不要像下面这样过于执着:
>>> # 我打算在这里将10赋给变量num
... num = 10
>>> # 希望不会出问题
... print(num)
10
>>> # 哎呀
相反,要说明为什么赋值
10
,为什么将变量命名为
num
。如果在编写华氏度到摄氏度的转
换工具,就应该让变量名自己表达出用途,而不是写一堆神秘的代码。要是再加点儿测试
代码自然更好,如例
19-1
所示。
19-1
 
f
toc1.py
def ftoc(f_temp):
"Convert Fahrenheit temperature <f_temp> to Celsius and return ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

可编程网络自动化

可编程网络自动化

Jason Edelman, Scott S. Lowe, Matt Oswalt
Python实用技能学习指南

Python实用技能学习指南

Posts & Telecom Press, Robert Smallshire, Austin Bingham
量子计算机编程:从入门到实践

量子计算机编程:从入门到实践

Eric R. Johnston, Nicholas Harrigan, Mercedes Gimeno-Segovia
Python编程入门与实战

Python编程入门与实战

Posts & Telecom Press, Fabrizio Romano

Publisher Resources

ISBN: 9787115586223