数据结构论坛

首页 » 分类 » 问答 » Python基础学习lesson1
TUhjnbcbe - 2025/4/25 17:33:00
python的基础知识02:52来自LearningYard学苑

Part1Python简介

Python由荷兰数学和计算机科学研究学会的GuidovanRossum于年代初设计,作为一门叫做ABC语言的替代品。Python提供了高效的高级数据结构,还能简单有效地面向对象编程。Python语法和动态类型,以及解释型语言的本质,使它成为多数平台上写脚本和快速开发应用的编程语言,随着版本的不断更新和语言新功能的添加,逐渐被用于独立的、大型项目的开发.

Python解释器易于扩展,可以使用C或C++(或者其他可以通过C调用的语言)扩展新的功能和数据类型。Python也可用于可定制化软件中的扩展程序语言。Python丰富的标准库,提供了适用于各个主要系统平台的源码或机器码。

PythonwasdesignedintheearlysbyGuidovanRossumoftheDutchSocietyofMathematicsandComputerScienceResearchasanalternativetotheABClanguage.Pythonprovidesefficienthigh-leveldatastructures,aswellassimpleandeffectiveobject-orientedprogramming.Pythonsyntaxanddynamictyping,aswellasthenatureofinterpretedlanguages,makeitaprogramminglanguageforscriptingandrapidapplicationdevelopmentonmostplatforms.Withthecontinuousupdateoftheversionandtheadditionofnewlanguagefeatures,ithasgraduallybeenusedforindependent,large-scaleapplications.Projectdevelopment.

ThePythoninterpreteriseasytoextend,andyoucanuseCorC++(orotherlanguagesthatcanbecalledbyC)toextendnewfunctionsanddatatypes.Pythoncanalsobeusedasanextendedprogramminglanguageincustomizablesoftware.Pythonsrichstandardlibraryprovidessourcecodeormachinecodesuitableforeachmajorsystemplatform.

Part2Python的使用特点

1.python以缩进表示*代码块*,以四个空格表示一次缩进,通常用tab键表示一次缩进。

1.Pythonusesindenttoindicate*codeblock*,andusesfourspacestoindicateanindentation,usuallywiththetabkeytoindicateanindentation.

示例1:

2.每个import只导入一个模块,最好按**标准库**、**拓展库**、**自定义库**的顺序依次进行。python的标准库是随着pyhon安装的时候默认自带的库;python的第三方库,需要下载后安装到python的安装目录下。不同的第三方库安装及使用方法不同。

标准库:os操作系统,time时间,random随机,pymysql连接数据库,threading线程,multiprocessing进程,queue队列。

第三方库:django,flask,requests,virtualenv,selenium,scrapy,xadmin,celery,re,hashlib,md5。

2.Eachimportonlyimportsonemodule,preferablyintheorderof**standardlibrary**,**expandedlibrary**,and**customlibrary**.Thestandardlibraryofpythonisthelibrarythat

1
查看完整版本: Python基础学习lesson1