1. python的名字源于英国超现实主义喜剧团体,而不是源自于蛇。
2.交互式环境是一个窗口,这是让你向计算机输入指令的程序;python的交互式窗口输入指令,供python解释器软件执行计算机读入输入的指令,并立即执行。
3.//表示整除或商数取整 比如22 // 8值为 2 ,/表示除法 比如20/8 值为2.5;=代表的含义是赋值,比如a=3,将3这个数值赋予给a,==是判断是否相等。
4.用//求取两数相除的商,用%求取两数相除的余数。
5.当一个变量名是大写,告诉人们这是一个常量,不应该主动修改它的值。
6.类似>>> input("请输入:")
请输入:22
‘22‘
7.一般的编辑器都会默认Tab键为四格缩进,但是在python脚本中,Tab与直接4个tablespace空格是有区别的。
8.break关键字,意思是跳出整个循环,continue关键字,用于跳出当次循环。
9.用import()函数将模块导入。
>>> 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!
10.不一定,用 def 语句创建函数时,可以用 return 语句指定应该返回什么值,但不一定非要用return语句。
11.在函数中定义的变量,其作用只是在该函数里,一个函数被调用时,就创建了一个局部作用域。在这个函数内赋值的所有变量,
原文:https://www.cnblogs.com/zhangqiushi/p/10958999.html