/python是1989年,Guido von Rossum在圣诞节闲着无聊开发的.(无聊果真是最大生产力)
/python的优点:balabalabala.
/python的缺点:
- 执行效率偏低,计算密集型任务需要C++;
- 代码无法加密;
- 开发时可供选择框架过多.
/python的应用场景:
- Web应用开发
- 云基础设施
- DevOps(开发运营)
- 网络爬虫开发
- 数据分析挖掘
- 机器学习
/环境搭建:balabalabala
/代码中的注释:
- 单行注释:以#号和空格开头的部分
- 多行注释:三个引号开头,三个引号结尾
/练习1:import this
import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
/练习2:turtle库
import turtle
turtle.pensize(4)
turtle.pencolor("red")
for i in range(4):
turtle.forward(100)
turtle.right(90)