看了python的相关资料,最大的特点就是其简单,容易上手.学完后感觉确实如此,现说说学完后的感觉.
1、python中双引号和单引号作用一样,print 'hello World'和print "hello World"是一样的(print语句中连接字符串用,)
2.python,使用变量,不需要定义类型,只要赋初值就行,和javascript中定义变量有点类似,只是更简单了,连var都不需要
3.python语法特别简单,每行结尾不需要;语句块完全依靠层次来区别,也就是说如果本该缩进一致的地方没有对齐,则程序会报错,这就从另一个角度确保了程序的编写规范性
4.python中的控制语句,if,while,for.值得注意的是条件都没有括号,条件后必须加:,while也可以有else语句
if a == 3 : print 'it is 3' elif a == 5 : print 'it is bigger than 3' else : print 'it is smaller than 3'
5.python 类的对象,就是java中类的一个实例,假如有类Person,则用p=Person(['参数'....]),即可以调用Person中的方法.
值得注意的是,python中类的方法的第一个参数必须是self(相当于java中的this),python没有构造方法,创建类后会自动调用类的__init__()方法,可以把这个方法等价于java等的构造方法,完成一些初始化操作
6.python既是面向过程又是面向对象
7.python 定义函数的方法
def fun_name(parameter1,parameter2...): pass#函数体
8.python,模块的概念,即把一个程序提出来公用,也是一个普通的python文件,在其它要调用的程序中import 模块名就OK了,然后使用模块名.方法就可以用其方法,也可from 模块名 import 方法名,然后直接调用方法即可
9.python,异常的写法
try: 语句体 except(Exception名称,可以是自定义的exception): .......... finally: .........
10.python中的数据结构有列表,元组,字典.其定义如下
mylist = ['apple','banana','orange']列表 zoo = ('aaa','bbb','ccc')元组 dic = {'zhang':'san', 'li':'si','wang':'wu'}
感谢大家的阅读,希望大家收益多多。
本文转自: https://blog.csdn.net/BeWhatYouAre/article/details/7295427
推荐教程:《python教程》
以上是给大家分享一下日常学习python的心得(详解)的详细内容。更多信息请关注PHP中文网其他相关文章!

pythonuseshybridapprace,ComminingCompilationTobyTecoDeAndInterpretation.1)codeiscompiledtoplatform-Indepententbybytecode.2)bytecodeisisterpretedbybythepbybythepythonvirtualmachine,增强效率和通用性。

theKeyDifferencesBetnewpython's“ for”和“ for”和“ loopsare:1)” for“ loopsareIdealForiteringSequenceSquencesSorkNowniterations,而2)”,而“ loopsareBetterforConterContinuingUntilacTientInditionIntionismetismetistismetistwithOutpredefinedInedIterations.un

在Python中,可以通过多种方法连接列表并管理重复元素:1)使用 运算符或extend()方法可以保留所有重复元素;2)转换为集合再转回列表可以去除所有重复元素,但会丢失原有顺序;3)使用循环或列表推导式结合集合可以去除重复元素并保持原有顺序。

fasteStmethodMethodMethodConcatenationInpythondependersonListsize:1)forsmalllists,operatorseffited.2)forlargerlists,list.extend.extend()orlistComprechensionfaster,withextendEffaster,withExtendEffers,withextend()withextend()是extextend()asmoremory-ememory-emmoremory-emmoremory-emmodifyinginglistsin-place-place-place。

toInSerteLementIntoApythonList,useAppend()toaddtotheend,insert()foreSpificPosition,andextend()formultiplelements.1)useappend()foraddingsingleitemstotheend.2)useAddingsingLeitemStotheend.2)useeapecificindex,toadapecificindex,toadaSpecificIndex,toadaSpecificIndex,blyit'ssssssslorist.3 toaddextext.3

pythonlistsareimplementedasdynamicarrays,notlinkedlists.1)他们areStoredIncoNtiguulMemoryBlocks,mayrequireRealLealLocationWhenAppendingItems,EmpactingPerformance.2)LinkesedlistSwoldOfferefeRefeRefeRefeRefficeInsertions/DeletionsButslowerIndexeDexedAccess,Lestpypytypypytypypytypy

pythonoffersFourmainMethodStoreMoveElement Fromalist:1)删除(值)emovesthefirstoccurrenceofavalue,2)pop(index)emovesanderturnsanelementataSpecifiedIndex,3)delstatementremoveselemsbybybyselementbybyindexorslicebybyindexorslice,and 4)

toresolvea“ dermissionded”错误Whenrunningascript,跟随台词:1)CheckAndAdjustTheScript'Spermissions ofchmod xmyscript.shtomakeitexecutable.2)nesureThEseRethEserethescriptistriptocriptibationalocatiforecationAdirectorywherewhereyOuhaveWritePerMissionsyOuhaveWritePermissionsyYouHaveWritePermissions,susteSyAsyOURHomeRecretectory。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

禅工作室 13.0.1
功能强大的PHP集成开发环境

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

记事本++7.3.1
好用且免费的代码编辑器

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器