重新梳理Python基础(8)

1. 整理python的关键字

# _*_ coding:utf-8 _*_

and

del #删除list中的某个元素或者这个list,同样适用于字典

from

not

while

as

elif

global

or

with #http://www.cnblogs.com/Brogrammer/archive/2012/07/23/2605570.html

assert #assert语句用来声明某个条件是真的。例如,如果你非常确信某个你使用的列表中至少有一个元素,而你想要检验这一点,并且在它非真的时候引发一个错误,那么assert语句是应用在这种情形下的理想语句。当assert语句失败的时候,会引发一个AssertionError。

else

if

pass

yield # http://developer.51cto.com/art/201301/379132.htm

break

except #类似于try...catch语句

import

print

class

exec #exec语句用来执行储存在字符串或文件中的Python语句。例如,我们可以在运行时生成一个包含Python代码的字符串,然后使用exec语句执行这些语句。

in

raise

continue

finally

is

return

def

for

lambda

try

2. 数据类型

View Code
True

False

None

strings

numbers

floats

lists

3. 字符串输出格式

View Code
%d

%i

%o

%u

%x

%X

%e

%E

%f

%F

%g

%G

%c

%r

%s

%%

4. 运算符

View Code
+

-

*

**

/

//

%

<

>

<=

>=

==

!=

<>

( )

[ ]

{ }

@

,

:

.

=

;

+=

-=

*=

/=

//=

%=

**=

 

你可能感兴趣的:(python)