From 2089c1c50d5477dcedd6aa69db28eb816dcab679 Mon Sep 17 00:00:00 2001 From: twowater <347073565@qq.com> Date: Sun, 18 Jun 2017 16:38:28 +0800 Subject: [PATCH] =?UTF-8?q?Signed-off-by:=20twowater=20<347073565@qq.com>?= =?UTF-8?q?=E8=8D=89=E6=A0=B9=E5=AD=A6Python=EF=BC=88=E4=B8=80=EF=BC=89?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AAPython=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- SUMMARY.md | 5 +++++ python1/IDE.md | 5 +++++ python1/Installation.md | 13 +++++++++++++ python1/Introduction.md | 23 +++++++++++++++++++++++ python1/Preface.md | 7 +++++++ python1/The_first_procedure.md | 18 ++++++++++++++++++ 7 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 python1/IDE.md create mode 100644 python1/Installation.md create mode 100644 python1/Introduction.md create mode 100644 python1/Preface.md create mode 100644 python1/The_first_procedure.md diff --git a/README.md b/README.md index c92cc60..8b6d7db 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,4 @@ |博客文章|平台| |:----- |:------| |Python 代码规范 | [掘金](https://juejin.im/post/593ebd7eac502e006b520a8f) ,[简书](http://www.jianshu.com/p/8b6c425b65a6) ,[CSDN](http://blog.csdn.net/Two_Water/article/details/73153945),[个人博客](http://twowater.com.cn/2017/06/13/Python%E4%BB%A3%E7%A0%81%E8%A7%84%E8%8C%83/)| - +|草根学Python(一)第一个Python程序|[掘金](https://juejin.im/post/594633e5ac502e006b9e1331),[简书](http://www.jianshu.com/p/0d757860c8cf),[CSDN](http://blog.csdn.net/Two_Water/article/details/73433637),[个人博客](http://twowater.com.cn/2017/06/18/%E8%8D%89%E6%A0%B9%E5%AD%A6Python-%E4%B8%80-%E7%AC%AC%E4%B8%80%E4%B8%AAPython%E7%A8%8B%E5%BA%8F/)| diff --git a/SUMMARY.md b/SUMMARY.md index 98e2bf1..2aa985f 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -5,3 +5,8 @@ * [一、简明概述](/codeSpecification/codeSpecification_first.md) * [二、注释](/codeSpecification/codeSpecification_second.md) * [三、命名规范](/codeSpecification/codeSpecification_third.md) +* [草根学Python(一)第一个Python程序](/python1/Preface.md) + * [一、Python 简介](/python1/Introduction.md) + * [二、Python 的安装](/python1/Installation.md) + * [三、第一个 Python 程序](/python1/The_first_procedure.md) + * [四、集成开发环境(IDE): PyCharm](/python1/IDE.md) \ No newline at end of file diff --git a/python1/IDE.md b/python1/IDE.md new file mode 100644 index 0000000..6058249 --- /dev/null +++ b/python1/IDE.md @@ -0,0 +1,5 @@ +# 四、集成开发环境(IDE): PyCharm # + +当然,在学习周期还是建议使用文本编辑器或者是[Sublime Text](http://www.sublimetext.com/) 这个工具来操作的,因为这样有利于我们了解整个流程,到一定的程度,或者开始项目的时候就可以使用集成的开发环境了,这样可以提高我们的效率。PyCharm 是由 JetBrains 打造的一款 Python IDE,支持 macOS、 Windows、 Linux 系统。 + +PyCharm 下载地址 : [https://www.jetbrains.com/pycharm/download/](https://www.jetbrains.com/pycharm/download/) diff --git a/python1/Installation.md b/python1/Installation.md new file mode 100644 index 0000000..99b5af6 --- /dev/null +++ b/python1/Installation.md @@ -0,0 +1,13 @@ +# 二、Python 的安装 # + +因为 Python 是跨平台的,它可以运行在 Windows、Mac 和各种 Linux/Unix 系统上。目前,Python 有两个版本,一个是 2.x 版,一个是 3.x版,这两个版本是不兼容的。本草根安装的是 3.6.1 版本的。 + +至于在哪里下载,本草根建议最好直接官网下载啦,随时下载下来的都是最新版本。官网地址:[https://www.python.org/](https://www.python.org/) + +本草根是 windows 系统,下载完后,直接安装,不过这里记得勾上Add Python 3.6 to PATH,然后点 “Install Now” 即可完成安装。如果没有勾上这个,就必须要自己配置环境变量了,至于如何配置,跟 JAVA 的差不多,具体可以 Google 一下。 + +![Python安装.png](http://upload-images.jianshu.io/upload_images/2136918-2bf6591f0a12e80b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + +安装完成后,打开命令提示符窗口,敲入 python 后,出现下面的情况,证明 Python 安装成功了。你看到提示符 >>> 就表示我们已经在 Python交互式环境中了,可以输入任何 Python 代码,回车后会立刻得到执行结果。 + +![运行python.png](http://upload-images.jianshu.io/upload_images/2136918-817c22f802e8cfce.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) \ No newline at end of file diff --git a/python1/Introduction.md b/python1/Introduction.md new file mode 100644 index 0000000..a7a88f9 --- /dev/null +++ b/python1/Introduction.md @@ -0,0 +1,23 @@ +# 一、Python 简介 # + +Python 是著名的“龟叔” Guido van Rossum 在 1989 年圣诞节期间,为了打发无聊的圣诞节而编写的一个编程语言。牛人就是牛人,为了打发无聊时间竟然写了一个这么牛皮的编程语言。 + +现在,全世界差不多有 600 多种编程语言,但流行的编程语言也就那么 20 来种。不知道你有没有听说过 TIOBE 排行榜。 + +这是 2017 年 2 月编程语言排行榜 TOP20 榜单: + +![2 月编程语言排行榜 TOP20 榜单.png](http://upload-images.jianshu.io/upload_images/2136918-1a4dfdbdd699c8b62.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + +还有就是 Top 10 编程语言 TIOBE 指数走势: + +![Top 10 编程语言 TIOBE 指数走势.png](http://upload-images.jianshu.io/upload_images/2136918-2714dba010ea5d75.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + +总的来说,这几种编程语言各有千秋,但不难看出,最近几年 Python 的发展非常的快,特别最近流行的机器学习,数据分析,更让 python 快速的发展起来。 + +Python 是高级编程语言,它有一个特点就是能快速的开发。Python 为我们提供了非常完善的基础代码库,覆盖了网络、文件、GUI、数据库、文本等大量内容,被形象地称作“内置电池(batteries included)”。用 Python 开发,许多功能不必从零编写,直接使用现成的即可。而且 Python 还能开发网站,多大型网站就是用 Python 开发的,例如 YouTube、Instagram,还有国内的豆瓣。很多大公司,包括 Google、Yahoo 等,甚至 NASA(美国航空航天局)都大量地使用 Python。 + +当然,任何编程语言有有点,也有缺点,Python 也不例外。那么 Python 有哪些缺点呢? + +第一个缺点就是运行速度慢,和C程序相比非常慢,因为Python是解释型语言,你的代码在执行时会一行一行地翻译成CPU能理解的机器码,这个翻译过程非常耗时,所以很慢。而C程序是运行前直接编译成CPU能执行的机器码,所以非常快。 + +第二个缺点就是代码不能加密。如果要发布你的 Python 程序,实际上就是发布源代码。像 JAVA , C 这些编译型的语言,都没有这个问题,而解释型的语言,则必须把源码发布出去。 \ No newline at end of file diff --git a/python1/Preface.md b/python1/Preface.md new file mode 100644 index 0000000..2a67728 --- /dev/null +++ b/python1/Preface.md @@ -0,0 +1,7 @@ +# 前言 # + +一时冲动,就开始把 Python 的知识点做个总结归纳了。[gitbook](https://www.readwithu.com/) 同时更新。 + +# 目录 # + +![草根学 Python(一) 第一个 Python 程序](https://dn-mhke0kuv.qbox.me/2903b288b72a7ddb730c.png) \ No newline at end of file diff --git a/python1/The_first_procedure.md b/python1/The_first_procedure.md new file mode 100644 index 0000000..720a4c2 --- /dev/null +++ b/python1/The_first_procedure.md @@ -0,0 +1,18 @@ +# 三、第一个 Python 程序 # + +Python 的代码使用文本编辑器就可以写了,本草根使用 [Sublime Text](http://www.sublimetext.com/),第一个 Python 程序当然是 Hello Python 啦,把这句话打印出来。 + +注意 print 前面不要有任何空格,最后保存下来,可以看到,Python 保存后是一个以 .py 为后缀的文件。 + +![HelloPython.png](http://upload-images.jianshu.io/upload_images/2136918-f0ec1b2c06d1ab18.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + + +最后就可以打开命令行窗口,把当前目录切换到 HelloPython.py 所在目录,就可以运行这个程序了,下面就是运行的结果。 + + +![运行第一个Python程序.png](http://upload-images.jianshu.io/upload_images/2136918-b7eb043853df29bd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + + +当然,如果你是使用 [Sublime Text](http://www.sublimetext.com/) ,并且在安装 Python 的时候配置好了环境变量,直接按 Ctrl + B 就可以运行了,运行结果如下: + +![Sublime运行Python.png](http://upload-images.jianshu.io/upload_images/2136918-a771a2fa1e4c03bd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) \ No newline at end of file