没有合适的资源?快使用搜索试试~ 我知道了~
Python 是一门解释型语言,它使用 CPython 解释器将 Python 代码编译成字节码。
资源推荐
资源详情
资源评论
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/release/download_crawler_static/89456298/bg1.jpg)
Python 是一门解释型语言,它使用 CPython 解释器将
Python 代码编译成字节码。对于初学者来说,你不需要
对 CPython 有过多了解,但你必须知道 Python 内部是
如何工作的。
Python 背后的哲学就是代码必须可读,这是通过缩进实
现的。Python 还支持很多编程范式,比如函数式编程和
面向对象编程。你将在阅读本文的过程中对它们有一个更
好的理解。
大多数初学者脑中的基本问题就是一门编程语言能够做什
么。这里是 Pyhton 的一些使用场景:
� 服务端开发(Django,Flask)
� 数据科学(Pytorch,Tensor-flow)
� 数据分析/可视化(Matplotlib)
� 脚本(Beautiful Soup)
� 嵌入式开发
注意:
我并不是特别为上面提到的任何库或框架背书,
它们在各自的领域中都非常流行,也得到了广泛使用。
安装:
![](https://csdnimg.cn/release/download_crawler_static/89456298/bg2.jpg)
学习任何编程语言的第一步都是安装它。如今,大多数操
作系统都自带 Python。你可以在终端执行以下命令,检
查 Python 是否可用:
python3 --version
输出如下:
Python 3.7.0
注意:你的 Python 版本可能会有所不同。如果你已经安
装过 Python 并且版本号在 3.5.2 以上,可以跳过这一
部分。
对于电脑上没有 Python 的人来说,下面是安装步骤:
� Windows 用户
� Mac 用户
� Linux 用户
Windows 用户:
� 打开 Python 官网。
� 点击下载按钮(下载 Python 3.8.2)[注意: 在你阅
读本文时,版本可能会有所不同]。
� 前往下载目录,双击安装程序。
� 勾选“Add Python 3.x to PATH”,并单击“Install
Now”。
![](https://csdnimg.cn/release/download_crawler_static/89456298/bg3.jpg)
� 安装完成后,你会收到一个“Setup was successful”的
提示。再次使用上面的命令检查 python 是否配置
正确。
� 使用命令 python3 --version 确认 Python 是否安装成
功以及配置正确。
Mac 用户
� 首先从应用商店安装 xcode。
� 如果你想从终端安装 Xcode,可以使用以下命令:
xcode-select --install
� 之后,我们将使用 brew 包管理器安装 Python。安
装和配置 brew 的命令如下:
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
� 当 brew 设置完成,就使用下面这条命令更新所有
过时的包:
brew update
� 使用以下命令安装 Python:
brew install python3
� 使用命令 python3 --version 确认 Python 是否安装成
功以及配置正确。
Linux 用户
� 使用 apt 安装 Python 的命令如下:
sudo apt install python3
![](https://csdnimg.cn/release/download_crawler_static/89456298/bg4.jpg)
� 使用 yum 安装 Python 的命令如下:
sudo yum install python3
� 使用命令 python3 --version 确认 Python 是否安装成
功以及配置正确。
Python shell:
Shell 将会是你遇到的最有用的工具之一。 Python shell
允许我们在将任何想法集成到应用之前进行快速测试。
打开终端或者命令行提示符,输入 python3 命令,你会得
到以下输出:
➜ python3.7
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
在本教程中,我们将利用你刚看到的 python3 shell 学习
一些概念。从现在开始,只要我提到“打开 Python
shell”,就表示你需要使用 python3 命令。
我们会创建一个以 .py 为扩展的文件 “testing”,用于学习
剩下的概念。我们将使用以下命令运行这个文件:
python3 testing.py
打开 Python shell,在 >>> 标记后输入 10 + 12,你会得到
22:
>>> 10 + 12
22
![](https://csdnimg.cn/release/download_crawler_static/89456298/bg5.jpg)
注释:
注释(comment)帮助我们(和其他人)理解为什么要写
某段代码,让代码的编写更加容易。注释的另一大作用就
是帮助我们提高代码的可读性。
# Stay Safe
当你像上面这么写时,Python 解释器就会知道它是一个
注释。# 之后的任何东西都不会被执行。
你可能想知道为什么应该使用注释。假设你是一名开发
者,被指派了一个庞大的项目,这个项目有超过一千行代
码。为了理解一切都是怎么工作的,你需要逐行阅读所有
的代码。
有比这更好的解决办法吗?哈哈,有,就是注释。注释帮
助我们理解为什么要写某段代码,它返回啥或者它干了
啥。注释看作是这段代码的文档。
打印:
除了编辑器的调试工具,最常帮助开发者解决问题的东西
就是 print 语句了。print 语句是所有编程中最容易被低
估的语法之一。
剩余72页未读,继续阅读
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
lantiandianzi
- 粉丝: 41
- 资源: 101
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 电脑配件管理系统数据库文件
- 基于预处理的小麦品种的分类和聚类源码+高分项目源码.7z
- BCI项目成果梳理,涵盖最新成果、算法创新、工程搭建、BCI大赛等
- S7-1500PLC工艺对象 105报文安装S7-1500PLC工艺对象 105报文安装S7-1500PLC工艺对象 105报文
- VID_20240626_120702_HSR_240.mp4
- 答题小程序-毕业设计资源
- code-gen-SQL资源
- Graduation Design Backend-毕业设计资源
- 一个简化的 Python 脚本示例,用于从连接到树莓派 GPIO 引脚的 DS18B20 温度传感器读取温度值 这个脚本假设你已
- 留学生网(www.lxs.net).docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)