最好的python 教程_最好的Python教程

最好的python 教程

Python is a general purpose programming language which is dynamically typed, interpreted, and known for its easy readability with great design principles.

Python是一种通用的编程语言,可以动态键入,解释并以其易于阅读的内容以及出色的设计原理而闻名。

freeCodeCamp has one of the most popular courses on Python. It's completely free (and doesn't even have any advertisements). You can watch it on YouTube here.

freeCodeCamp拥有Python上最受欢迎的课程之一。 它是完全免费的(甚至没有任何广告)。 您可以在YouTube上观看它

想了解更多? (Want to learn more?)

The web is a big place, there’s plenty more to explore:

网络是一个很大的地方,还有很多值得探索的地方:

Python的用途是什么? (What Is Python Used for?)

Python can easily be used for small, large, online and offline projects. The best options for utilizing Python are web development, simple scripting and data analysis. Below are a few examples of what Python will let you do:

Python可以轻松地用于小型,大型,在线和离线项目。 利用Python的最佳选择是Web开发,简单的脚本编写和数据分析。 以下是Python将为您提供帮助的一些示例:

Web开发: (Web Development:)

You can use Python to create web applications on many levels of complexity. There are many excellent Python web frameworks, including Pyramid, Django and Flask, to name a few.

您可以使用Python创建许多复杂级别的Web应用程序。 有许多出色的Python Web框架,包括Pyramid,Django和Flask等。

数据分析: (Data Analysis:)

Python is the leading language of choice for many data scientists. Python has grown in popularity within the field due to the availability of many excellent libraries focused on data science (of which NumPy and Pandas are two of the most well-known) and data visualisation (like Matplotlib and Seaborn). Pyton really made Data crunching fun with all its numerous available libraries. Ipython with JupyterLab is another form of Python that improves the usage of Python in the field of data science.

Python是许多数据科学家首选的主要语言。 由于许多专注于数据科学的优秀库(其中NumPy和Pandas是最著名的两个)和数据可视化(如Matplotlib和Seaborn)的可用性,Python在该领域变得越来越流行。 Pyton的所有可用库确实使数据处理变得有趣。 具有JupyterLab的Ipython是另一种Python形式,可改善Python在数据科学领域的使用。

自动化: (Automation:)

Python is a very flexible language that can be used to automate boring or repetitive tasks. System administrators often use it by writing scripts which can be easily executed from the terminal. Python can also be used to create bots which automate some of our daily tasks.

Python是一种非常灵活的语言,可用于自动执行无聊或重复的任务。 系统管理员通常通过编写可从终端轻松执行的脚本来使用它。 Python也可以用来创建自动执行我们日常任务的机器人。

人工智能: (Artificial Intelligence:)

Python is also used extensively in the growing field of Artificial Intelligence (AI). Google selected Python to be one of the first well-supported programming languages for training and interacting with models using Tensorflow.

Python在不断增长的人工智能(AI)领域中也得到广泛使用。 Google选择Python作为使用Tensorflow进行模型训练和与模型交互的首批受支持的编程语言之一。

移动应用开发 (Mobile app development)

Mobile apps and games can be created with python using Kivy, Pygame and PyQt.

可以使用Kivy,Pygame和PyQt使用python创建移动应用和游戏。

安全和网络: (Security And Networking:)

Python is used to build Networking tools and security-tools that are widely used. Python’s remote automation is the most secure, fast and efficient for cloud-testing of frameworks. That’s why professional developers use python for making the most secure frameworks and for socket-programming.

Python用于构建广泛使用的网络工具和安全工具。 Python的远程自动化是最安全,快速和高效的框架云测试。 这就是为什么专业开发人员使用python来制作最安全的框架和进行套接字编程的原因。

机器学习,深度学习 (Machine Learning, Deep Learning)

Python is one of the best languages suited for machine learning, deep learning and data analytics with a stronghold in all of them.

Python是适合机器学习,深度学习和数据分析的最佳语言之一,并且在所有语言中都有据点。

There are specialized languages best suited for various role such as R and MATLAB, but when it comes to overlapping fields of applications python wins hands down due to its flexibility and rapid prototyping and availability of libraries.

有最适合各种角色(例如R和MATLAB)的专用语言,但是当涉及到应用程序的重叠领域时,python因其灵活性,快速原型设计和库的可用性而脱颖而出。

电报机器人开发 (Telegram Bots Development)

You can use Python and some Python-libraries for developing your own Telegram Bots.

您可以使用Python和一些Python库来开发自己的Telegram Bots

通过抓取和抓取来收集数据 (Data Gathering by crawling and scraping)

Python can also be used to parse pages' source codes and retrieve its data. Using some python modules, such as Scrapy and also (for some pages which use javascript) Selenium should do the trick!

Python还可以用于解析页面的源代码并检索其数据。 使用一些python模块,例如Scrapy和Selenium(对于某些使用javascript的页面)也可以解决问题!

Python通常用于 (Python is generally used for)
  • Web & Internet Development

    网络与互联网开发
  • Educational Advancement

    教育进步
  • Scientific Studies/Computing

    科学研究/计算
  • Desktop development

    桌面开发
  • Numeric Computing

    数值计算
  • Software development

    软件开发
  • Business Application development

    业务应用开发
  • Machine Learning

    机器学习
  • IOT

    物联网
  • Game Development

    游戏开发
  • Rapid Prototyping

    快速成型
  • Browser Automation

    浏览器自动化
  • Data analysis

    数据分析
  • Scraping data from websites

    从网站抓取数据
  • Image Processing

    图像处理
一些涉及python可用性的文章 (Some articles covering the usability of python)

The official package index for python is here.

python的官方软件包索引在这里

您应该使用Python 2还是Python 3? (Should you use Python 2 or Python 3?)

The two versions are similar. If you know one, switching to writing code in the other is easy.

这两个版本相似。 如果您知道一个,就很容易切换到用另一个编写代码。

  • Python 2.x will not be maintained past 2020.

    Python 2.x将在2020年后不再维护。

  • 3.x is under active development. This means that all recent standard library improvements, for example, are only available by default in Python 3.x.

    3.x正在积极开发中。 举例来说,这意味着所有最新的标准库改进仅在Python 3.x中默认可用。
  • Python ecosystem has amassed a significant amount of quality software over the years. The downside of breaking backwards compatibility in 3.x is that some of that software (especially in-house software in companies) still doesn’t work on 3.x yet.

    多年来,Python生态系统已经积累了大量的优质软件。 在3.x中破坏向后兼容性的不利之处在于某些软件(尤其是公司内部的软件)仍无法在3.x上运行。

安装 (Installation)

Most *nix based operating systems come with Python installed (usually Python 2, Python 3 in most recent ones). Replacing your system's default installation of Python is not recommended and may cause problems. However, different versions of Python can be safely installed alongside your system's default version. See Python Setup and Usage.

大多数基于* nix的操作系统都安装了Python(通常是Python 2,最新的是Python 3)。 不建议替换系统的默认Python安装,这可能会导致问题。 但是,可以安全地安装不同版本的Python和系统的默认版本。 请参阅Python设置和用法

Windows doesn’t come with Python, but the installer and instructions can be found here.

Windows并未随附Python,但可以在此处找到安装程序和说明。

Python解释器 (Python Interpreter)

The Python interpreter is what is used to run Python scripts.

Python解释器是用于运行Python脚本的工具。

If it is available and in Unix shell’s search path, it's possible to start it by typing the command python followed by the script name. This will invoke the interpreter and run the script.

如果可用并且在Unix shell的搜索路径中,可以通过键入命令python和脚本名称来启动它。 这将调用解释器并运行脚本。

hello_campers.py

hello_campers.py

print('Hello campers!')

From the terminal:

从终端:

$ python hello_campers.py
Hello campers!

When multiple versions of Python are installed, calling them by version is possible depending on the install configuration. In the Cloud9 IDE custom environment, they can be invoked like:

当安装了多个版本的Python时,取决于安装配置,可以按版本调用它们。 在Cloud9 IDE定制环境中,可以像这样调用它们:

$ python --version
Python 2.7.6
$ python3 --version
Python 3.4.3
$ python3.5 --version
Python 3.5.1
$ python3.6 --version
Python 3.6.2 
$ python3.7 --version
Python 3.7.1

Python解释器互动模式 (Python Interpreter Interactive Mode)

Interactive mode can be started by invoking the Python interpreter with the -i flag or without any arguments.

可以通过使用-i标志或不带任何参数调用Python解释器来启动交互模式。

Interactive mode has a prompt where Python commands can be entered and run:

交互模式提示您可以输入和运行Python命令:

$ python3.5
Python 3.5.1 (default, Dec 18 2015, 00:00:00)
GCC 4.8.4 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello campers!")
Hello campers!
>>> 1 + 2
3
>>> exit()
$

Python的禅宗 (The Zen of Python)

Some of the principles that influenced the design of Python are included as an Easter egg and can be read by using the command inside Python interpreter interactive mode:

一些影响Python设计的原则作为复活节彩蛋包含在内,可以通过使用Python解释器交互模式内的命令来读取:

>>> 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!

Python的优缺点 (Pros and Cons of Python)

优点 (Pros)

  1. Interactive language with a module support for almost all functionality.

    带有模块的交互式语言几乎支持所有功能。
  2. Open Source: So, you can contribute to the community, the functions you have developed for future use and to help others

    开源:因此,您可以为社区做出贡献,为将来使用开发的功能并为他人提供帮助
  3. A lot of good interpreters and notebooks available for better experience like jupyter notebook.

    许多优秀的口译员和笔记本都可以提供更好的体验,例如jupyter notebook。
缺点 (Cons)
  1. Being open source, many different ways have developed over the years for the same functions. This sometimes creates chaos for others to read someone's else code.

    作为开源,多年来为相同功能开发了许多不同的方法。 有时,这会使其他人无法阅读别人的代码。
  2. It is a slow language. So it's a very bad language to use for developing general algorithms.

    这是一种慢语言。 因此,用于开发通用算法是一种非常糟糕的语言。

文献资料 (Documentation)

Python is well documented. These docs include tutorials, guides, references and meta information for language.

Python有据可查 。 这些文档包括语言的教程,指南,参考和元信息。

Another important reference is the Python Enhancement Proposals (PEPs). Included in the PEPs is a style guide for writing Python code, PEP 8.

另一个重要参考是Python增强建议( PEP )。 PEP中包括用于编写Python代码PEP 8的样式指南。

调试 (Debugging)

Inline print statements can be used for simple debugging:

内联print语句可用于简单调试:

… often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.

…通常,调试程序的最快方法是在源代码中添加一些打印语句:快速的edit-test-debug周期使这种简单的方法非常有效。

… often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.

…通常,调试程序的最快方法是在源代码中添加一些打印语句:快速的edit-test-debug周期使这种简单的方法非常有效。

… often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.Executive Summary

…通常,调试程序的最快方法是在源代码中添加一些打印语句:快速的edit-test-debug周期使这种简单的方法非常有效。 执行摘要

Python also includes more powerful tools for debugging, such as:

Python还包括更强大的调试工具,例如:

Just note that these exist for now.

请注意,这些暂时存在。

你好,世界! (Hello World!)

Going back to the docs, we can read about the print function, a built-in function of the Python Standard Library.

回到文档,我们可以了解到print函数,这是Python Standard Library内置函数

print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

The built-in functions are listed in alphabetical order. The name is followed by a parenthesized list of formal parameters with optional default values. Under that is a short description of the function and its parameters are given and there is occasionally an example.

内置功能按字母顺序列出。 该名称后是带括号的形式参数列表,带有可选的默认值。 在此之下是对该函数及其参数的简短描述,并且偶尔会有一个示例。

The print function in Python 3 replaces the print statement in Python 2.

Python 3中的print函数取代了Python 2中的print语句。

>>> print("Hello world!")
Hello world!

A function is called when the name of the function is followed by (). For the Hello world! example, the print function is called with a string as an argument for the first parameter. For the rest of the parameters the defaults are used.

当函数名称后跟()时,将调用该函数。 对于世界你好! 例如,使用字符串作为第一个参数的参数调用打印函数。 对于其余参数,将使用默认值。

The argument that we called the print function with is a str object or string, one of Python’s built-in types. Also the most important thing about python is that you don’t have to specify the data type while declaring a variable; python’s compiler will do that itself based on the type of value assigned.

我们使用print函数调用的参数是str对象或字符串 ,这是Python的内置类型之一 。 另外,关于python的最重要的事情是,您不必在声明变量时指定数据类型。 python的编译器将根据分配的值的类型自行执行此操作。

The objects parameter is prefixed with a * which indicates that the function will take an arbitrary number of arguments for that parameter.

objects参数以*开头,表示该函数将对该参数采用任意数量的参数。

翻译自: https://www.freecodecamp.org/news/best-python-tutorial/

最好的python 教程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值