- 博客(4)
- 收藏
- 关注
原创 str.maketrans(x[, y[, z]])
传入参数x,y,z 当传入一个参数既x时: transtab = str.maketrans({'a':'b'}) news = 'apple' print (news.translate(transtab)) 必须使用字典传入参数而且字典只能为整数或者一个字符 当传入两个参数时: transtab = str.maketrans('ap','bs') news = 'apple' print ...
2019-04-13 11:41:53
717
原创 is 与==
a = [1, 2, 3] b = a b is a True b == a True b = a[:] b is a False b == a True is 是判断两个变量引用对象是否为同一个 == 用于判断引用变量的值是否相等 ...
2019-04-11 13:39:51
179
原创 逻辑运算符and or not问题
a and b a or b not a and not b==not (a or b) and (),’’,[],{},0,None在布尔上下文中为False,还有特别定义为False其余都为True 若上下文都True,则返回最后一个值,若某个值为False则返回第一个False值 or 如果有一个True则返回这个True值,如果都为False则返回最后一个False值。 ...
2019-04-11 13:33:47
1281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅