python关键字,运算符

时间:2023-12-23 13:01:38

关键字:

and

or

not

del

import导入

from import的来源

whilewhile循环

for for循环

if elif else条件结构

break

continue

global声明全局变量

with as

assert断言

pass表示这是空块,eg,创建一个没有内容的类

try异常处理

except

catch

yield

finally

break

print打印

class

exec

in遍历用,for循环或列表

raise 引发一个异常

is判断两个对象是否相等

return函数返回值

def定义函数

lambdalamda表达式

运算符:

** Exponentiation (raise to the power)
~ + - Complement, unary plus and minus (method names for the last two are +@ and -@)
* / % // Multiply, divide, modulo and floor division
+ - Addition and subtraction
>> << Right and left bitwise shift
& Bitwise 'AND'
^ | Bitwise exclusive OR' and regularOR'
<= < > >= Comparison operators
<> == != Equality operators
= %= /= //= -= += *= **= Assignment operators
is is not Identity operators
in not in Membership operators
not or and Logical operators