Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 681 Bytes

File metadata and controls

19 lines (13 loc) · 681 Bytes

python与C/C++的不同

操作符

x or y逻辑或
lambda args: expression匿名函数
x and y逻辑与
not x逻辑反
is, is not身份测试
in, not in序列成员关系测试
x ** yx的y次方

字符串

python中也可以格式化字符串,并且支持的是和c中printf相同的格式。

e.g.: “%d, %s, %d” %(1, ‘aa’, 4)

r’\ab\c’或R”\ab\c”表示\ab\c这个字符串是原始字符串(raw string),它不会把\当作转义符,它通常用于正则表达式。