《Python程序设计》——Python入门

今天开始为大家带来《Python程序设计》的学习。今天的内容是第一章——Python入门,主要内容有Python概述和程序开发。Today we

《Python程序设计》——Python入门

今天开始为大家带来《Python程序设计》的学习。今天的内容是第一章——Python入门,主要内容有Python概述和程序开发。

Today we start to bring you the study of Python Programming. Today's content is Chapter 1 – Getting Started with Python, which focuses on Python overview and program development.

01

Python概述

(1)Python简介:Python是一个高层次的结合了解释性,编译性,互动性和面向对象的脚本语言,支持命令式编程,函数式编程和面向对象程序设计,具有广泛的应用领域。

(2)Python的特点:与其他编程语言相比较,Python具有许多优势,比如:简单易学,可移植性,解释性,面向对象,可扩展性和可嵌入性,丰富的库和模块。但是,和C,C++等程序设计语言相比,Python程序运行速度较慢。

(3)Python的应用:Python广泛应用于各个领域,比如:常规软件开发,科学计算与数据分析,**爬虫(又称为**蜘蛛,是大数据行业获取数据的核心工具,Python是编写**爬虫中的主要编程语言),Web应用开发,系统**运维,人工智能与机器学习。

(1) Introduction to Python: Python is a high-level combination of interpreted, compiled, interactive and object-oriented scripting language that supports imperative programming, functional programming and object-oriented programming, and has a wide range of application areas.

(2) Features of Python: Compared with other programming languages, Python has many advantages, such as: easy to learn, portability, interpretability, object-oriented, extensibility and embeddability, rich libraries and modules. However, compared with C, C++ and other programming languages, Python programs run slower.

(3) Applications of Python: Python is widely used in various fields, such as: conventional software development, scientific computing and data *ysis, web crawlers (also known as web spiders, which are the core tools for acquiring data in the big data industry, and Python is the main programming language for writing web crawlers), web application development, system network operation and maintenance, artificial intelligence and machine learning.

02

程序开发

《Python程序设计》——Python入门《Python程序设计》——Python入门

(1)程序运行方式

Python程序可以在交互模式和脚本模式下运行

①交互模式运行。在程序功能简单,代码较少的情况下,可以使用交互模式开发Python程序。运行方法:在Python命令行界面下输入Python命令,回车运行,得到运行结果。

②脚本模式运行。具有复杂功能的Python代码量大,一般采用脚本模式运行,即使用一个文本编辑软件(如记事本)编写Python源代码,保存到扩展名为.py的源文件,然后用Python解释器执行。

(2)使用Pyhon自带工具开发Python程序

Python程序开发有两种方法:Windows命令行方式和IDLE方式。

①Windows命令行方式

在Windows命令行方式中,Python程序可以使用交互模式编程和脚本模式编程。

a.交互模式编程:交互模式编程只需要在Python环境下输入Python语句,回车运行,即可得到运行结果。

b.脚本模式编程:脚本模式编程需要先编写Python源文件,再在Windows命令行下使用Python解释器执行。

②IDLE方式

IDLE是Python内置的集成开发环境,由Python安装包提供,是Python自带的文本编辑器,选择“开始”——“所有程序”——“Python 3.7”,运行IDLE。和Windows命令行方式一样,在Python自带的IDLE中,也可以以交互模式或脚本模式开发Python程序。

(1) Program Operation Modes

Python programs can be run in both interactive and scripting modes

① Interactive mode operation. If the program is simple and the code is all, you can use the interactive mode to develop Python programs. How to run: Type Python command in Python command line interface, enter and run, and get the running result.

②Run in script mode. Python code with complex functions is large, so it is usually run in script mode, that is, use a text editing software (such as Notepad) to write Python source code, save it to a source file with the extension .py, and then execute it with the Python interpreter.

(2) Developing Python programs using Pyhon's own tools

There are two ways to develop Python programs: the Windows command line method and the IDLE method.

①Windows command line method

In the Windows command line method, Python programs can be programmed in interactive mode and scripting mode.

a. Interactive mode programming: Interactive mode programming only requires entering Python statements in the Python environment and running them with a carriage return to get the running results.

b. Scripting mode programming: Scripting mode programming requires writing Python source files first, and then executing them with the Python interpreter under the Windows command line.

②IDLE method

IDLE is Python's built-in integrated development environment, provided by the Python installation package, which is Python's own text editor. "As with the Windows command line method, you can develop Python programs in interactive or scripting mode in the IDLE that comes with Python. Python programs.

参考资料:文字:百度;图片:微博;翻译:百度翻译

本文由LearningYard新学苑原创,部分图片文字来自**,如有侵权请联系。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

(0)
AndyAndy认证作者
上一篇 2023年1月12日 11:40
下一篇 2023年1月12日 11:48

相关文章

发表回复

登录后才能评论

客服QQ: 8838832

客服微信