本文主要是介绍Mosh python从入门到精通---getting stared,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
python的应用领域:
python3安装
我们这次要学Python3。官网安装之后记得勾选
命令提示符:python,Ctrl+z
python interpretor
在此可以编程
code editor
IDE:integrated development environment
\
editor
editor之VS code
下载,安装,
file- open file-新建文件夹
刷新
print内置函数,内置函数built-in function should always use ()
表情需要win .同时按
之后红字步骤
Python Extension
Convert VS code to a powerful IDE for building python applications
IDE内容
安装扩展程序,install 之后可能需要reload
可以看到已有python的检查工具pylinting,分析代码并发现问题的工具。
Linting Code
现在开始,打错了代码会报错
This problem panel lists all the issues.
put this on the right side of the screen
View----command palette, very important feature in the future
Formatting Code
python peps:Python Enhancement Proposals
PEP 0 – Index of Python Enhancement Proposals (PEPs) | peps.python.org
Format document
for example,x=1 to x = 1,
we need to click view,command palette, tap in format document, and then execute this, there will be a message inform you to install autopep8, install it
command palette, tap format document, execute ,now x = 1,beautiful!
如果出现这种情况
可以打完代码之后同时按住shift+alt+F
或者
回到原来的文件,随便打乱格式,这时候Ctrl+s,发现自动回复到正常格式。
Running python code
下载并安装
打代码,ctrl+s保存,CTRL+alt+n,在output中得到如下结果
可以看到如上还是python-u,我们要改成python3
这一届没太懂,因为找不到视频中所说的user settings界面
25:00
python implementations
概念
python implementations是一个理解rules并且执行代码的程序。
在我们下载的时候,这是default implementation of python(默认实现),称为Cpython
其他的一些implementatons以及写他们的语言
一些功能可能在某一种实现即implementation中可用,在另外一种不可用,或者实现方式不同。
为什么除了cpython之外还需要其他implementation?
因为这些的不同,程序员未达成共识,而且如果你是Java开发人员,要将java代码导入python,就要用jython替代cpython。其他同理
How Python code is executed
因此mac和window无法运行一个program。因为两者有不同机器代码,就像是人们说不一样的语言。
但Java解决了这个问题,后来c#和python也解决了
Jython的使用原理,最终结果是Java bytecode,会在JVM中执行
quiz
what is an expression?
what is a syntax error?
what dose a linter do?
quiz答案
比如"**"*3
Or bad grammar in the code
jutsu其实是due to
a linter is a tool that checks our codes of potential errors,mostly in the category of syntactical errors.
这篇关于Mosh python从入门到精通---getting stared的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!