Python程序员都知道的入门知识の零
目录:
1. 工具
2. Python的基本概念
3. 错误总结
4. Python Web开发的一个小框架:Flask
目录【Python程序员都知道的入门知识】

1. 工具
Python官网Windows版的下载地址:
https://www.python.org/downloads/windows/
根据自己电脑的位数选择相对应的安装包下载安装。
可以看到官网有两个比较突出的版本3.系列的和2.系列的,主要是两者的版本语法存在很大的不同,而且不兼容。
点击这里https://docs.python.org/3/whatsnew/3.0.html查看Python新特性

2. Python的基本概念
2.1. Python是什么类型的语言?
Python是一种开放源代码的脚本编程语言。
2.2. Python有哪些特性?
自动缩进、语法高亮显示、单词自动完成(Alt+/)、命令历史查询(Alt+n上一条,Alt+p下一条)、大小写敏感。
2.3. IDLE是什么?
Python安装完毕后自带了这个集成开发环境,IDLE即Python Shell外壳,是一个通过键入文本与程序交互的途径。相当于Windows下的Command.利用这个开发环境可以方便的进行创建、运行、测试、调试Python程序。
2.3.1 创建:IDLE下:File->new File

2.3.2. 运行:File编辑器下:Run->Run Module
2.3.3. 调试:IDLE下:Debug->Debugger

2.3.4. 常用编辑功能
Find in files :在制定的文件中查找单词或模式
Replace:替换单词或模式
Indent region:使所选内容右移一级,增加缩进量
Dedent region:减少缩进量
Comment out region:将所选内容编程注释
Expand word:单词自动完成
Toggle tabs:打开或关闭制表位
2.4. BIF内置函数
像Java的 String.subString();
一样,Python也提供了很多内置函数,所谓的内置函数即BIF(Built in Functions)。
在IDLE中输入 dir(__builtins__)
就会一长串,小写字母开头的都是内置函数,总共有68个BIF,如果不知道怎么用,如input方法,在IDLE中输入help(input)
可以查看说明。
3. 错误总结
在IDLE下,File->New FIle,新建一个python文件,在其中编写下图中的代码然后保存,运行(Run --Run Module)时出现语法错误:

【缩进问题】虽说Python是有提供自动完成缩进的功能,但不能完全相信,有时候需要自己检查下这个问题。上图就是没有自己改变缩进导致的程序报错。这样的一个问题强化了我对Python将缩进纳入语法中这一特性的理解,Python通过缩进语法化将代码风格进一步统一了。
修改后的代码:

运行结果:

4. Python Web开发的一个小框架:Flask
Flask是一个使用 Python 编写的轻量级 Web 应用框架。
点击这里http://docs.jinkan.org/docs/flask/查看Flask的开发文档